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

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 10 11:58:10 PST 2021


fhahn marked an inline comment as done.
fhahn added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/EarlyCSE.cpp:1369
         }
-        if (auto *I = dyn_cast<Instruction>(V))
-          I->andIRFlags(&Inst);
+        if (auto *I = dyn_cast<Instruction>(V)) {
+          if (programUndefinedIfPoison(I)) {
----------------
reames wrote:
> Per LangRef, nnan and ninf are poison generating.  The handling on the other FMF flags is unclear to me.  I'd suggest as a stepping stone restricting the preservation of flags to non-float instructions while leaving a clear TODO.
Update and added todo.   D115527 still seems helpful, but probably only once the poison-generating FMFs are explicitly handled.


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