[PATCH] D111744: [instcombine] PRE freeze to only potentially posion/undef operand of phi

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 13 10:14:22 PDT 2021


reames created this revision.
reames added reviewers: nikic, aqjune, hyeongyukim, spatel.
Herald added subscribers: bollu, hiraditya, mcrosier.
reames requested review of this revision.
Herald added a project: LLVM.

This extends the foldOpIntoPhi code used when visiting a freeze user of a phi to allow any non-undef/poison operand as opposed to only non-undef/poison constants.

While this works, I'm not sure this is the right way to solve this problem.  We're replacing a very cheap check with a bounded search of each phi operand, which has potential compile time implications.  (@nikic - Could you help quantify?)

This routine is fairly limited.  I went looking for a stronger routine (because really we're just folding the phi away when inst-simplify can prove there's an existing value for all but one operand), but was shocked not to find one (anywhere).  I've got a toy binop test case that shows we entirely miss the corresponding opportunity at O3 <https://reviews.llvm.org/owners/package/3/>.

I'm really curious on others take here.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111744

Files:
  llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
  llvm/test/Transforms/InstCombine/freeze.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111744.379448.patch
Type: text/x-patch
Size: 5890 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211013/5157d3c3/attachment.bin>


More information about the llvm-commits mailing list