[PATCH] D38494: [ScalarEvolution] Handling for ICmp occuring in the evolution chain.

Jun Ryung Ju via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 23 04:23:30 PDT 2017


junryoungju added a comment.

Did you checked that this fixes emits right assemblies on clang?
sometimes it doesn't optimizes even it emits correct loop-count on opt



================
Comment at: lib/Analysis/ScalarEvolution.cpp:4092
+    const SCEV *Result = Rewriter.visit(S);
+    return Rewriter.isValid() ? Result : SE.getCouldNotCompute();
+  }
----------------
It still can computable if after simplify loop forms.
using SE.getCouldNotCompute() isn't a good idea.

see what happens on end of createAddRecFromPHI method.


================
Comment at: lib/Analysis/ScalarEvolution.cpp:4789
   // If the value coming around the backedge is an add with the symbolic
   // value we just inserted, then we found a simple induction variable!
   if (const SCEVAddExpr *Add = dyn_cast<SCEVAddExpr>(BEValue)) {
----------------
Is that really evolutable if BEValue is not a AddExpr?
we cannot assume that is always AddExpr.

this cannot evolute if isn't a AddExpr.


================
Comment at: lib/Analysis/ScalarEvolution.cpp:6499
+
+const SCEV *ScalarEvolution::evaluateForICmp(ICmpInst *IC) {
+  BasicBlock *Latch = nullptr;
----------------
It isn't really evoluting ICmp, just returning its true cond or false cond.
I think we should change this method name more intuitively


https://reviews.llvm.org/D38494





More information about the llvm-commits mailing list