[PATCH] D105392: [InstCombine] Add optimization to prevent poison from being propagated.

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 4 15:05:16 PDT 2021


nikic added a comment.

Can you please add a test for freeze of phi? I expect this will fail because you can't insert an instruction before a phi. It's okay to simply bail on this case for now.



================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:3554-3556
+  // If all operands are guaranteed to be non-poison, we can drop freeze.
+  if (!MaybePoisonOperand)
+    return OrigOp;
----------------
lebedev.ri wrote:
> Note that it was a question, i don't know what should we be doing here.
Normally the freeze would get dropped by the basic isGuaranteedNotToBeUndefOrPoison() fold already. I think we can only hit this case due to recursion bailout (we effectively allow one more level of recursion here).

As it doesn't cut us anything to do so, just dropping the freeze here seems reasonable.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105392



More information about the llvm-commits mailing list