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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 13 11:54:04 PDT 2021


nikic accepted this revision.
nikic added a comment.
This revision is now accepted and ready to land.

LGTM

> 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?)

Not seeing a compile-time impact from this. Generally freeze is sufficiently rare that we don't need to be overly concerned with compile-time at this point.

> 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/>.

So you're basically looking for this transform, but replacing ConstFold with InstSimplify? Would be possible, but I think this would be fairly expensive.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111744/new/

https://reviews.llvm.org/D111744



More information about the llvm-commits mailing list