[PATCH] D139818: [IndVars][NFCI] Remove supposedly dead code to save some CT

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 12 01:20:09 PST 2022


mkazantsev created this revision.
mkazantsev added reviewers: nikic, lebedev.ri, fhahn, reames.
Herald added subscribers: javed.absar, hiraditya.
Herald added a project: All.
mkazantsev requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

I ran a big corps of Fuzz tests and could not find a case when predicate
evaluated to 'false' would fire here, seems that they all get optimized away
by other means. I am not 100% sure this is an NFC, but if it really causes
any troubles, we should add a test demonstrating it's useful. Otherwise,
we save some CT by reducing number of SCEV queries.


https://reviews.llvm.org/D139818

Files:
  llvm/lib/Transforms/Scalar/IndVarSimplify.cpp


Index: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -1384,8 +1384,8 @@
   const SCEV *LHSS = SE->getSCEVAtScope(LHS, L);
   const SCEV *RHSS = SE->getSCEVAtScope(RHS, L);
   // Can we prove it to be trivially true or false?
-  if (auto EV = SE->evaluatePredicateAt(Pred, LHSS, RHSS, BI)) {
-    foldExit(L, ExitingBB, /*IsTaken*/ !*EV, DeadInsts);
+  if (SE->isKnownPredicate(Pred, LHSS, RHSS, BI)) {
+    foldExit(L, ExitingBB, /*IsTaken*/ false, DeadInsts);
     return true;
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139818.482025.patch
Type: text/x-patch
Size: 657 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221212/8b5970d9/attachment.bin>


More information about the llvm-commits mailing list