[llvm] r241312 - Fix an overly aggressive assertion in getCopyFromPartsVector.

Nadav Rotem nrotem at apple.com
Thu Jul 2 16:23:52 PDT 2015


Author: nadav
Date: Thu Jul  2 18:23:52 2015
New Revision: 241312

URL: http://llvm.org/viewvc/llvm-project?rev=241312&view=rev
Log:
Fix an overly aggressive assertion in getCopyFromPartsVector.

The assertion in getCopyFromPartsVector assumed that the vector 'part' must
match the type of argument (arguments are potentially split into multiple
parts). However, in some cases the targets return a 'part' of the right size
but with a different type. We already handle this case correctly later on
and generate a bitcast. This commit just makes sure that we are actually
checking the property that we care about.


Added:
    llvm/trunk/test/CodeGen/AArch64/aarch-multipart.ll
Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=241312&r1=241311&r2=241312&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Thu Jul  2 18:23:52 2015
@@ -261,8 +261,9 @@ static SDValue getCopyFromPartsVector(Se
     assert(NumRegs == NumParts && "Part count doesn't match vector breakdown!");
     NumParts = NumRegs; // Silence a compiler warning.
     assert(RegisterVT == PartVT && "Part type doesn't match vector breakdown!");
-    assert(RegisterVT == Parts[0].getSimpleValueType() &&
-           "Part type doesn't match part!");
+    assert(RegisterVT.getSizeInBits() ==
+           Parts[0].getSimpleValueType().getSizeInBits() &&
+           "Part type sizes don't match!");
 
     // Assemble the parts into intermediate operands.
     SmallVector<SDValue, 8> Ops(NumIntermediates);

Added: llvm/trunk/test/CodeGen/AArch64/aarch-multipart.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/aarch-multipart.ll?rev=241312&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/aarch-multipart.ll (added)
+++ llvm/trunk/test/CodeGen/AArch64/aarch-multipart.ll Thu Jul  2 18:23:52 2015
@@ -0,0 +1,18 @@
+; RUN: llc < %s -o - | FileCheck %s
+
+target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
+target triple = "arm64-apple-os"
+
+declare <4 x double> @user_func(<4 x double>) #1
+
+; Make sure we are not crashing on this code.
+; CHECK-LABEL: caller_function
+; CHECK: ret
+define void @caller_function(<4 x double>, <4 x double>, <4 x double>, <4 x double>, <4 x double>) #1 {
+entry:
+  %r = call <4 x double> @user_func(<4 x double> %4)
+  ret void
+}
+
+attributes #1 = { nounwind readnone }
+





More information about the llvm-commits mailing list