[PATCH] D102171: [InstSimplify] Constant fold cast expressions with no already folded ops

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 10 07:44:19 PDT 2021


bjope created this revision.
bjope added reviewers: spatel, nikic, lebedev.ri.
Herald added a subscriber: hiraditya.
bjope requested review of this revision.
Herald added a project: LLVM.

The test case added in this commit includes reduced IR from a test
that failed when dumping the IR in textual form (e.g. when outputting
the .ll file). In general it is a known problem that one could end
up with huge constant expressions that aren't friendly to the
textual format at hand, see for example PR38538 for another example.
However, in the test case added here it should be possible to fold
the constant expression but there seem to be some problem with the
SimplifyCastInst having problems to fold the cast expression if the
operand isn't folded already. And some passes (such as SROA) seem to
generate constant expressions that aren't folded already.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102171

Files:
  llvm/lib/Analysis/InstructionSimplify.cpp
  llvm/test/Transforms/InstSimplify/constantfold-cast-expression-not-already-folded-operand.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102171.344061.patch
Type: text/x-patch
Size: 7722 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210510/1e9535c1/attachment.bin>


More information about the llvm-commits mailing list