Skip to content

Commit

Permalink
[GISel] Simplify getConstantVRegValWithLookThrough. NFC.
Browse files Browse the repository at this point in the history
  • Loading branch information
jayfoad committed Mar 8, 2024
1 parent 5d98d88 commit 430de48
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions llvm/lib/CodeGen/GlobalISel/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,18 +355,17 @@ std::optional<ValueAndVReg> getConstantVRegValWithLookThrough(
if (!MaybeVal)
return std::nullopt;
APInt &Val = *MaybeVal;
while (!SeenOpcodes.empty()) {
std::pair<unsigned, unsigned> OpcodeAndSize = SeenOpcodes.pop_back_val();
switch (OpcodeAndSize.first) {
for (auto [Opcode, Size] : reverse(SeenOpcodes)) {
switch (Opcode) {
case TargetOpcode::G_TRUNC:
Val = Val.trunc(OpcodeAndSize.second);
Val = Val.trunc(Size);
break;
case TargetOpcode::G_ANYEXT:
case TargetOpcode::G_SEXT:
Val = Val.sext(OpcodeAndSize.second);
Val = Val.sext(Size);
break;
case TargetOpcode::G_ZEXT:
Val = Val.zext(OpcodeAndSize.second);
Val = Val.zext(Size);
break;
}
}
Expand Down

0 comments on commit 430de48

Please sign in to comment.