[PATCH] D137339: [SimplifyCFG] Allow speculating block containing assume()

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 3 07:59:17 PDT 2022


nikic created this revision.
nikic added reviewers: spatel, aeubanks, RKSimon.
Herald added a subscriber: hiraditya.
Herald added a project: All.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

SpeculativelyExecuteBB(), which converts a branch + phi structure into a select, currently bails out if the block contains an assume (because it is not speculatable).

Adjust the fold to ignore ephemeral values (i.e. assumes and values only used in assumes) for cost modelling purposes, and drop them when performing the fold.

Theoretically, we could try to preserve the assume information by generating a `assume(br_cond || assume_cond)` style assume, but this is very unlikely to to be useful (because we don't do anything useful with assumes of this form) and it would make things substantially more complicated once we take operand bundle assumes into account (which don't really support a `||` operation). I'd prefer not to do that without good motivation.


https://reviews.llvm.org/D137339

Files:
  llvm/lib/Transforms/Utils/SimplifyCFG.cpp
  llvm/test/Transforms/SimplifyCFG/assume.ll
  llvm/test/Transforms/SimplifyCFG/two-entry-phi-fold-crash.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137339.472942.patch
Type: text/x-patch
Size: 6571 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221103/a4ad4812/attachment.bin>


More information about the llvm-commits mailing list