[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 13:23:33 PDT 2021


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:3543
+  if (auto *Inst = dyn_cast<Instruction>(Op0)) {
+    Value *NotGuaranteedNonPoisonOperand;
+    unsigned NumGuaranteedNonPoisonOperand = 0;
----------------
lebedev.ri wrote:
> lebedev.ri wrote:
> > 
> And actually, what do we want to do if there are several operands with the same `Value`?
> Unless that is okay for us (we'd still only need a single `freeze`) and we want to rewrite them all,
> i guess we need to record the operand index, not the value.
This is why it should be `Use *` rather than `Value *`.

Just to be perfectly clear, this code should be `Use *NotGuaranteedNonPoisonOperand = nullptr` and then below `NotGuaranteedNonPoisonOperand = &U` and `replaceUse(*NotGuaranteedNonPoisonOperand, FI)`.

Also maybe rename `NotGuaranteedNonPoisonOperand` to `MaybePoisonOperand`, it's a mouthful :)


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