[PATCH] D98697: [IndVars] Provide eliminateIVComparison with context

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 16 05:08:47 PDT 2021


mkazantsev added inline comments.


================
Comment at: llvm/test/Transforms/IndVarSimplify/scev-expander-preserve-lcssa.ll:119
 ; CHECK:       if.end106:
-; CHECK-NEXT:    br i1 false, label [[FOR_BODY84]], label [[RETURN_LOOPEXIT]]
+; CHECK-NEXT:    br i1 true, label [[FOR_BODY84]], label [[RETURN_LOOPEXIT]]
 ; CHECK:       return.loopexit:
----------------
mkazantsev wrote:
> mkazantsev wrote:
> > Looks like it's a bug needs to be fixed before we can go with it.
> Funny thing that both `false` and `true` are correct here.
> `false` is obviously correct because `inc` is strictly positive and `i.0` is non-positive, and this is what is proved without context.
> However `true` is also correct because this is guarded by
> ```
> br i1 %cmp8243, label %for.body84, label %return
> ```
> which is an impossible condition. In fact, this code is unreachable so anything is OK.
btw this is a lead for further compile time opt that we are missing. Blocks guarded by `false` conditions can have any predicate proved automatically, to save some time.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98697/new/

https://reviews.llvm.org/D98697



More information about the llvm-commits mailing list