[llvm] [SimplifyCFG] handle monotonic wrapped case for D150943 (PR #65882)
Kohei Asano via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 11 21:49:27 PDT 2023
================
@@ -6082,15 +6083,20 @@ SwitchLookupTable::SwitchLookupTable(
LinearMappingPossible = false;
break;
}
- Wrapped |=
- Dist.isStrictlyPositive() ? Val.sle(PrevVal) : Val.sgt(PrevVal);
+ NMon |= Dist.isStrictlyPositive() ? Val.sle(PrevVal) : Val.sgt(PrevVal);
}
PrevVal = Val;
}
if (LinearMappingPossible) {
LinearOffset = cast<ConstantInt>(TableContents[0]);
LinearMultiplier = ConstantInt::get(M.getContext(), DistToPrev);
- LinearMapValWrapped = Wrapped;
+ bool MayMWrap = false, MayOWrap = false;
+ APInt M = LinearMultiplier->getValue(), O = LinearOffset->getValue();
+ APInt Res = O.sadd_ov(
----------------
khei4 wrote:
Thanks! Thinking carefully, if the first multiplication isn't wrapped, monotonicity is enough to see addition isn't wrapped. Remove Addition Wrap check.
https://github.com/llvm/llvm-project/pull/65882
More information about the llvm-commits
mailing list