[PATCH] D103033: [LoopStrengthReduce] Ensure that debug intrinsics do not affect LSR's output

Stephen Tozer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 24 09:16:22 PDT 2021


StephenTozer created this revision.
StephenTozer added reviewers: qcolombet, echristo, craig.topper, vsk, aprantl, djtodoro.
StephenTozer added a project: debug-info.
Herald added a subscriber: hiraditya.
StephenTozer requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Fixes bug 50427: https://bugs.llvm.org/show_bug.cgi?id=50427

During Loop Strength Reduce, if the terminating condition for the loop is not immediately adjacent to the terminating branch and it has more than one use, a clone of the condition will be created just before the terminating branch and will be used as the branch condition. Currently, whether the instructions are "immediately adjacent" is determined by checking whether the next instruction after the condition is the terminating branch; this is incorrect however, as the presence of a debug intrinsic between the two will result in a change to the output. This is fixed by using `getNextNonDebugInstruction()` instead.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D103033

Files:
  llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
  llvm/test/Transforms/LoopStrengthReduce/X86/lsr-cond-dbg.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103033.347416.patch
Type: text/x-patch
Size: 7157 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210524/32651400/attachment.bin>


More information about the llvm-commits mailing list