[PATCH] D131169: [InstSimplify] Fold fcmp with dominating assume
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 5 09:37:28 PDT 2022
spatel added a comment.
This looks right. I made some cosmetic changes to this code in the last day (hopefully easier to read), so you'll need to rebase/update.
Please add the new tests with baseline (current) output to D131168 <https://reviews.llvm.org/D131168>. That way, we'll show the diffs in this patch.
It would be good to confirm that everything checks out with Alive2 as well. I don't know of any programmatic way to cycle through the predicates, but you can verify by pasting in the before/after IR for these (and possibly more) tests:
https://alive2.llvm.org/ce/z/5EEWrF
================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:6761
+ // Both LHS and RHS are cmps.
+ const CmpInst *LHSCmp = dyn_cast<CmpInst>(LHS);
if (LHSCmp)
----------------
Shorten:
if (auto *LHSCmp = dyn_cast<CmpInst>(LHS))
return isImplied...
================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:6784
- if (const ICmpInst *RHSCmp = dyn_cast<ICmpInst>(RHS))
+ if (const CmpInst *RHSCmp = dyn_cast<CmpInst>(RHS))
return isImpliedCondition(LHS, RHSCmp->getPredicate(),
----------------
Similar to above: use "auto *" here to reduce code.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131169/new/
https://reviews.llvm.org/D131169
More information about the llvm-commits
mailing list