[PATCH] D148001: [LICM] Reassociate & hoist sub expressions
Serguei Katkov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun May 28 21:19:57 PDT 2023
skatkov accepted this revision.
skatkov added a comment.
This revision is now accepted and ready to land.
LGTM with comment for consideration - I do not insist.
================
Comment at: llvm/lib/Transforms/Scalar/LICM.cpp:2610
+ auto &DL = L.getHeader()->getModule()->getDataLayout();
+ bool ProvedNoOverflowAfterReassociate =
+ VariantSubtracted
----------------
Not sure it is more readable (may be only for me) but consider
```
// C1 - LV < C2 case, so we need C1 - C2 does not overflow.
if (VariantSubtracted && computeOverflowForSignedSub(InvariantOp, InvariantRHS, DL, AC,
&ICmp, DT) != llvm::OverflowResult::NeverOverflows)
return false;
// LV - C1 < C2 case, so we need C1 + C2 does not overflow.
if (!ValueSubrtacted && computeOverflowForSignedAdd(InvariantOp, InvariantRHS, DL, AC,
&ICmp, DT) != llvm::OverflowResult::NeverOverflows)
return false;
```
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148001/new/
https://reviews.llvm.org/D148001
More information about the llvm-commits
mailing list