[PATCH] D125449: [ConstantFold] Fold bitcasts on scalable vector splats.

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 12 00:32:52 PDT 2022


sdesmalen created this revision.
sdesmalen added reviewers: david-arm, kmclaughlin, craig.topper, frasercrmck.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
sdesmalen requested review of this revision.
Herald added subscribers: llvm-commits, alextsao1999.
Herald added a project: LLVM.

This patch also contains changes to InstCombine to avoid a regression for
scalable-const-fp-splat.ll which otherwise would no longer be folded
because the expression is not an explicit ConstExpr any more, but a folded
splat instead.

This patch additionally fixes

  https://github.com/llvm/llvm-project/issues/55348.

where one of the operands to be sunk was a ConstExpr. Because the m_pattern()
functions also match ConstExpr's, the cast<Instruction> following the match
led to an assertion failure. Because we now fold the ConstExpr, there is no
longer a way to represent a sext/zext as a ConstExpr and the patterns no
longer match.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125449

Files:
  llvm/lib/IR/ConstantFold.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
  llvm/test/Transforms/CodeGenPrepare/AArch64/sink-free-instructions.ll
  llvm/test/Transforms/InstCombine/addrspacecast.ll
  llvm/test/Transforms/InstCombine/scalable-const-fp-splat.ll
  llvm/test/Transforms/InstSimplify/ConstProp/vscale-inseltpoison.ll
  llvm/test/Transforms/InstSimplify/ConstProp/vscale.ll
  llvm/test/Transforms/InstSimplify/vscale-inseltpoison.ll
  llvm/test/Transforms/InstSimplify/vscale.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125449.428865.patch
Type: text/x-patch
Size: 11146 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220512/73032416/attachment.bin>


More information about the llvm-commits mailing list