[PATCH] D52072: [PowerPC] Fix the assert of combineBVOfConsecutiveLoads when element num is 1

qshanz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 19 20:12:38 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL342611: [PowerPC] Fix the assert of combineBVOfConsecutiveLoads when element num is 1 (authored by qshanz, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D52072?vs=165466&id=166217#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D52072

Files:
  llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
  llvm/trunk/test/CodeGen/PowerPC/crash.ll


Index: llvm/trunk/test/CodeGen/PowerPC/crash.ll
===================================================================
--- llvm/trunk/test/CodeGen/PowerPC/crash.ll
+++ llvm/trunk/test/CodeGen/PowerPC/crash.ll
@@ -15,3 +15,20 @@
   store i8 %bf.set, i8* %x3, align 4
   ret void
 }
+
+; A BUILD_VECTOR of 1 element caused a crash in combineBVOfConsecutiveLoads()
+; Test that this is no longer the case
+define signext i32 @test2() {
+entry:
+  %retval = alloca i32, align 4
+  %__a = alloca i128, align 16
+  %b = alloca i64, align 8
+  store i32 0, i32* %retval, align 4
+  %0 = load i128, i128* %__a, align 16
+  %splat.splatinsert = insertelement <1 x i128> undef, i128 %0, i32 0
+  %splat.splat = shufflevector <1 x i128> %splat.splatinsert, <1 x i128> undef, <1 x i32> zeroinitializer
+  %1 = bitcast <1 x i128> %splat.splat to <2 x i64>
+  %2 = extractelement <2 x i64> %1, i32 0
+  store i64 %2, i64* %b, align 8
+  ret i32 0
+}
Index: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
===================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
+++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -11901,7 +11901,8 @@
     IsRoundOfExtLoad = LD->getExtensionType() == ISD::EXTLOAD;
   }
   // Not a build vector of (possibly fp_rounded) loads.
-  if (!IsRoundOfExtLoad && FirstInput.getOpcode() != ISD::LOAD)
+  if ((!IsRoundOfExtLoad && FirstInput.getOpcode() != ISD::LOAD) ||
+      N->getNumOperands() == 1)
     return SDValue();
 
   for (int i = 1, e = N->getNumOperands(); i < e; ++i) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52072.166217.patch
Type: text/x-patch
Size: 1566 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180920/49164d59/attachment.bin>


More information about the llvm-commits mailing list