[PATCH] D115247: [EarlyCSE] Retain poison flags, if program is UB if poison.

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 10 12:25:19 PST 2021


nikic accepted this revision.
nikic added a comment.

LG



================
Comment at: llvm/lib/Transforms/Scalar/EarlyCSE.cpp:1376
+          // instructions.
+          if (I->getType()->isFloatingPointTy() ||
+              !I->hasPoisonGeneratingFlags() || !programUndefinedIfPoison(I))
----------------
fhahn wrote:
> nikic wrote:
> > This should be checking `isa<FPMathOperator>` instead. It's not necessarily the result type that's a float (e.g. fcmp).
> fixed, thanks!
I think this would be more obvious as `isa<FPMathOperator>(I) || (I->hasPoisonGeneratingFlags() && !programUndefindeIfPoison(I))`, though in practice it's the same.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115247



More information about the llvm-commits mailing list