[PATCH] D20983: [InstCombine] scalarizePHI should not assume the code it sees has been CSE'd

Michael Kuperstein via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 3 14:02:03 PDT 2016


mkuper added a comment.

Thanks, David!


================
Comment at: lib/Transforms/InstCombine/InstCombineVectorOps.cpp:69
@@ -68,4 +68,3 @@
 Instruction *InstCombiner::scalarizePHI(ExtractElementInst &EI, PHINode *PN) {
-  // Verify that the PHI node has exactly 2 uses. Otherwise return NULL.
-  if (!PN->hasNUses(2))
-    return nullptr;
+  SmallVector <Instruction*, 2> Extracts;
+  // The users we want the PHI to have are:
----------------
majnemer wrote:
> Please clang-format this.
Argh, I was sure I did!

================
Comment at: test/Transforms/InstCombine/vec_phi_extract.ll:30-32
@@ +29,5 @@
+define void @copy(i64 %val, i32  %limit, i32 *%ptr) {
+; CHECK-LABEL: @copy
+; CHECK: %0 = trunc i64
+; CHECK: %1 = phi i32
+entry:
----------------
majnemer wrote:
> Please give these instructions some operands.
Yeah, should probably fix the rest of the test while I'm at it.


http://reviews.llvm.org/D20983





More information about the llvm-commits mailing list