Skip to content

Commit 4e607ec

Browse files
committed
[SCCP] Flip range arguments for NSW region check.
This brings the operand order in line with the NUW handling, which was missed out in 72121a2. At the moment this is NFC as we only additions, but it should fix miscompiles with 024115a recommitted.
1 parent 025c920 commit 4e607ec

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/Transforms/Utils/SCCPSolver.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ static bool refineInstruction(SCCPSolver &Solver,
153153
}
154154
if (!Inst.hasNoSignedWrap()) {
155155
auto NSWRange = ConstantRange::makeGuaranteedNoWrapRegion(
156-
Instruction::Add, RangeA, OverflowingBinaryOperator::NoSignedWrap);
157-
if (NSWRange.contains(RangeB)) {
156+
Instruction::Add, RangeB, OverflowingBinaryOperator::NoSignedWrap);
157+
if (NSWRange.contains(RangeA)) {
158158
Inst.setHasNoSignedWrap();
159159
Changed = true;
160160
}

0 commit comments

Comments
 (0)