[PATCH] D140751: Implement a FIXME for better poison handling in SimplifyCFG.

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 2 01:48:49 PST 2023


nikic added a comment.

This is still missing tests.



================
Comment at: llvm/lib/Transforms/Utils/SimplifyCFG.cpp:335
+      return true;
+    if (isa<UndefValue>(IV1) && isGuaranteedNotToBePoison(IV0))
+      return true;
----------------
nikic wrote:
> You need to check PoisonValue first, because PoisonValue is also an UndefValue.
What I meant here is to move the PoisonValue checks below to above the UndefValue checks, so they are handled first.


================
Comment at: llvm/lib/Transforms/Utils/SimplifyCFG.cpp:341
+      return true;
+    if (isa<PoisonValue>(IV1) && !isa<PoisonValue>(IV0))
+      return true;
----------------
resistor wrote:
> nikic wrote:
> > The `!isa<PoisonValue>` checks shouldn't be necessary.
> Why?
If one value is poison, the other doesn't matter. Now, if both were actually poison this would already be handled by IV0 == IV1 above, but there's no need to spell it out here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140751



More information about the llvm-commits mailing list