[llvm-commits] [llvm] r81180 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp test/CodeGen/X86/store-empty-member.ll
Dan Gohman
gohman at apple.com
Mon Sep 7 18:44:02 PDT 2009
Author: djg
Date: Mon Sep 7 20:44:02 2009
New Revision: 81180
URL: http://llvm.org/viewvc/llvm-project?rev=81180&view=rev
Log:
Fix an abort on a store of an empty struct member. getValue returns
null in the case of an empty struct, so don't try to call getNumValues
on it.
Added:
llvm/trunk/test/CodeGen/X86/store-empty-member.ll
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=81180&r1=81179&r2=81180&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Mon Sep 7 20:44:02 2009
@@ -861,6 +861,10 @@
for (User::const_op_iterator OI = C->op_begin(), OE = C->op_end();
OI != OE; ++OI) {
SDNode *Val = getValue(*OI).getNode();
+ // If the operand is an empty aggregate, there are no values.
+ if (!Val) continue;
+ // Add each leaf value from the operand to the Constants list
+ // to form a flattened list of all the values.
for (unsigned i = 0, e = Val->getNumValues(); i != e; ++i)
Constants.push_back(SDValue(Val, i));
}
Added: llvm/trunk/test/CodeGen/X86/store-empty-member.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/store-empty-member.ll?rev=81180&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/store-empty-member.ll (added)
+++ llvm/trunk/test/CodeGen/X86/store-empty-member.ll Mon Sep 7 20:44:02 2009
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | llc -march=x86 | FileCheck %s
+
+; Don't crash on an empty struct member.
+
+; CHECK: movl $2, 4(%esp)
+; CHECK: movl $1, (%esp)
+
+%testType = type {i32, [0 x i32], i32}
+
+define void @foo() nounwind {
+ %1 = alloca %testType
+ volatile store %testType {i32 1, [0 x i32] zeroinitializer, i32 2}, %testType* %1
+ ret void
+}
More information about the llvm-commits
mailing list