[PATCH] D24147: Lower consecutive select instructions correctly.

Dehao Chen via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 2 21:55:46 PDT 2016


danielcdh added inline comments.

================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:4558
@@ +4557,3 @@
+  }
+  SmallPtrSet<const Instruction *, 2> INS;
+  for (const auto *SI : ASI) {
----------------
davidxl wrote:
> Early return true if ASI size is 1?
code removed

================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:4564
@@ +4563,3 @@
+    if (INS.count(I1) || INS.count(I2))
+      return false;
+    INS.insert(SI);
----------------
davidxl wrote:
> Add a comment here for explanation.
code removed

================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:4622
@@ +4621,3 @@
+
+  if (!ShouldOptimize)
+    return false;
----------------
davidxl wrote:
> Instead of skipping the optimization, It is better to keep the current behavior if those selects can not be grouped -- optimize them one by one. Skipping optimization completely need more discussion and can be done as follow up.
Had a better fix to make sure that the PHI can be lowered even there is dependency.


https://reviews.llvm.org/D24147





More information about the llvm-commits mailing list