[PATCH] D128917: [SCEVExpander] Use IRBuilder to create BinOp

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 30 08:01:30 PDT 2022


nikic created this revision.
nikic added reviewers: fhahn, reames.
Herald added subscribers: jsji, pengfei, javed.absar, hiraditya.
Herald added a project: All.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This makes InsertBinOp in SCEVExpander go through the IRBuilder, which will fold the operation with InstSimplifyFolder. When doing this, it's important that the flags are directly passed to the builder, not fixed up after the fact, because it might have folded to some unrelated instruction. Expose a CreateNoWrapBinOp API for this purpose.

I am somewhat uncertain whether this change is actually desirable though. This does fold things as expected, but I'm not sure it's wanted in the LSR case, e.g. because it can shift a use from `iv.inc` to `iv`. Any thoughts on that?


https://reviews.llvm.org/D128917

Files:
  llvm/include/llvm/IR/IRBuilder.h
  llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
  llvm/test/CodeGen/Thumb2/LowOverheadLoops/no-dec-le-simple.ll
  llvm/test/CodeGen/X86/break-false-dep.ll
  llvm/test/Transforms/LoopDeletion/pr53969.ll
  llvm/test/Transforms/LoopStrengthReduce/X86/2011-11-29-postincphi.ll
  llvm/test/Transforms/LoopStrengthReduce/X86/pr46943.ll
  llvm/test/Transforms/LoopStrengthReduce/depth-limit-overrun.ll
  llvm/test/Transforms/LoopStrengthReduce/wrong-hoisting-iv.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128917.441400.patch
Type: text/x-patch
Size: 35278 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220630/a74a9a5e/attachment.bin>


More information about the llvm-commits mailing list