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

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 4 12:49:43 PDT 2021


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:3528
 
+  // Try to push freeze through instructions that propagate but don't produce
+  // poison as far as possible.  If operand of freeze follows three conditions
----------------
This should go into a new function


================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:3543
+  if (auto *Inst = dyn_cast<Instruction>(Op0)) {
+    Value *NotGuaranteedNonPoisonOperand;
+    unsigned NumGuaranteedNonPoisonOperand = 0;
----------------



================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:3546-3549
+      if (isGuaranteedNotToBeUndefOrPoison(U.get()))
+        NumGuaranteedNonPoisonOperand++;
+      else
+        NotGuaranteedNonPoisonOperand = U.get();
----------------



================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:3552
+
+    if (Inst->hasOneUse() && !canCreateUndefOrPoison(dyn_cast<Operator>(Op0)) &&
+        NumGuaranteedNonPoisonOperand ==
----------------
These checks should be done first


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