[PATCH] D29618: Avoid skipping instructions in IndVarSimplify::sinkUnusedInvariants

Roman Morylev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 9 10:49:48 PST 2017


rmorylev added inline comments.


================
Comment at: lib/Transforms/Scalar/IndVarSimplify.cpp:2344
 
     if (I != Preheader->begin()) {
       // Skip debug info intrinsics.
----------------
sanjoy wrote:
> I'd instead do this change as:
> 
>  - Remove the `isa<DbgInfoIntrinsic>(I)` related complexity here (i.e. lines 2344-2354, and the `if (Done) break;` bits), since we check for `DbgInfoIntrinsic` and `continue` over them anyway.
> 
>  - Do `I++` right after `Instruction *ToMove = &*I;`.
> 
> This would make the entry invariant into the loop "`I` points to one past the instruction we want to sink", and the `I--` in the beginning of the loop body would do the right thing.
Agree. I was just trying to make the patch simple.


Repository:
  rL LLVM

https://reviews.llvm.org/D29618





More information about the llvm-commits mailing list