[PATCH] D24147: Lower consecutive select instructions correctly.

David Li via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 12 12:23:55 PDT 2016


davidxl added inline comments.

================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:4586
@@ +4585,3 @@
+/// If \p isTrue is true, return the true value of \p SI, otherwise return
+/// false value of \p SI. If the true/false value of \p SI defined by any
+/// select instructions in \p Selects, look through the defining select
----------------
is defined

================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:4589
@@ +4588,3 @@
+/// instruction until the true/false value is not defined in \p Selects.
+Value *getTrueOrFalseValue(SelectInst *SI, bool isTrue,
+                           const SmallPtrSet<const Instruction *, 2> &Selects) {
----------------
make it static.

================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:4594
@@ +4593,3 @@
+    V = (isTrue ? SI->getTrueValue() : SI->getFalseValue());
+    SI = dyn_cast<SelectInst>(V);
+  } while (SI && Selects.count(SI));
----------------
Before the loop save SI to SI0. Here an assert can be added to make SI and SI0 have same cond.


https://reviews.llvm.org/D24147





More information about the llvm-commits mailing list