[PATCH] D117110: [InstCombine] try to fold binop with phi operands

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 12 12:55:11 PST 2022


lebedev.ri added a comment.

In D117110#3237746 <https://reviews.llvm.org/D117110#3237746>, @aeubanks wrote:

> is it possible that we're hoisting a non-speculatable operation past something like a call in the same block?

Indeed. If the binop is not freely speculatable, then we need to check that it is guaranteed to be executed: https://alive2.llvm.org/ce/z/VqvC_r



================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:1299-1301
+  if (BO.getParent() != Phi0->getParent() ||
+      BO.getParent() != Phi1->getParent())
+    return nullptr;
----------------
This is too restrictive (please add a fixme?) 
https://alive2.llvm.org/ce/z/kKuiW9 vs https://alive2.llvm.org/ce/z/SJ9oYU



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

https://reviews.llvm.org/D117110



More information about the llvm-commits mailing list