[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 09:31:13 PDT 2021


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:3544
+    SmallPtrSet<const Value *, 4> NonPoisonOps;
+    getGuaranteedNonPoisonOps(Inst, NonPoisonOps);
+    if (Inst->hasOneUse() && !canCreateUndefOrPoison(dyn_cast<Operator>(Op0)) &&
----------------
This is the wrong API to use here: You want `isGuaranteedNotToBeUndefOrPoison()` on the operands of the instruction.

`getGuaranteedNonPoisonOps()` is about which operands of an instruction would result in immediate UB if they are poison.


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