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

Sanjoy Das via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 8 22:29:13 PST 2017


sanjoy requested changes to this revision.
sanjoy added inline comments.
This revision now requires changes to proceed.


================
Comment at: lib/Transforms/Scalar/IndVarSimplify.cpp:2344
 
     if (I != Preheader->begin()) {
       // Skip debug info intrinsics.
----------------
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.


Repository:
  rL LLVM

https://reviews.llvm.org/D29618





More information about the llvm-commits mailing list