[PATCH] D116935: [IRBuilder] Introduce folder using inst-simplify, use for Or fold.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 10 05:53:15 PST 2022


fhahn created this revision.
fhahn added reviewers: reames, nikic, lebedev.ri, nhaehnle.
Herald added subscribers: dexonsmith, hiraditya.
fhahn requested review of this revision.
Herald added a project: LLVM.

Alternative to D116817 <https://reviews.llvm.org/D116817>.

This introduces a new value-based folding interface for Or (FoldOr),
which takes 2 values and returns an existing Value or a constant if the
Or can be simplified. Otherwise nullptr is returned. This replaces the
more restrictive CreateOr which takes 2 constants.

This is the used to implement a folder that uses InstructionSimplify.
The logic to simplify `Or` instructions is moved there. Subsequent
patches are going to transition other CreateXXX to the more general
FoldXXX interface.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D116935

Files:
  llvm/include/llvm/Analysis/InstSimplifyFolder.h
  llvm/include/llvm/Analysis/TargetFolder.h
  llvm/include/llvm/IR/ConstantFolder.h
  llvm/include/llvm/IR/IRBuilder.h
  llvm/include/llvm/IR/IRBuilderFolder.h
  llvm/include/llvm/IR/NoFolder.h
  llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h
  llvm/lib/Analysis/InstructionSimplify.cpp
  llvm/lib/Transforms/Scalar/SROA.cpp
  llvm/test/Transforms/LoopDistribute/scev-inserted-runtime-check.ll
  llvm/test/Transforms/LoopVectorize/runtime-check-small-clamped-bounds.ll
  llvm/test/Transforms/LoopVersioning/wrapping-pointer-versioning.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116935.398599.patch
Type: text/x-patch
Size: 27981 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220110/768bb8c5/attachment.bin>


More information about the llvm-commits mailing list