summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2014-09-20 00:10:47 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2014-09-20 00:10:47 +0000
commit975726345cb4914152fd7d07d92d41dcfd921503 (patch)
treefb7b9a1240dd5cf2924e826f204b24445e1bebee
parentd780781b1f273b16eb0d1355a173180764e73fc6 (diff)
downloadbcm5719-llvm-975726345cb4914152fd7d07d92d41dcfd921503.tar.gz
bcm5719-llvm-975726345cb4914152fd7d07d92d41dcfd921503.zip
Fix crash with an insertvalue that produces an empty object.
llvm-svn: 218171
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp6
-rw-r--r--llvm/test/CodeGen/Generic/empty-insertvalue.ll7
2 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 6d302f98f55..6a8cd2eb3b1 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -3307,6 +3307,12 @@ void SelectionDAGBuilder::visitInsertValue(const InsertValueInst &I) {
unsigned NumValValues = ValValueVTs.size();
SmallVector<SDValue, 4> Values(NumAggValues);
+ // Ignore an insertvalue that produces an empty object
+ if (!NumAggValues) {
+ setValue(&I, DAG.getUNDEF(MVT(MVT::Other)));
+ return;
+ }
+
SDValue Agg = getValue(Op0);
unsigned i = 0;
// Copy the beginning value(s) from the original aggregate.
diff --git a/llvm/test/CodeGen/Generic/empty-insertvalue.ll b/llvm/test/CodeGen/Generic/empty-insertvalue.ll
new file mode 100644
index 00000000000..e4cc27c2ffc
--- /dev/null
+++ b/llvm/test/CodeGen/Generic/empty-insertvalue.ll
@@ -0,0 +1,7 @@
+; RUN: llc < %s
+
+define void @f() {
+entry:
+ %0 = insertvalue { [0 x { i8*, i8* }], [0 x { i8*, i64 }] } undef, [0 x { i8*, i8* }] undef, 0
+ ret void
+}
OpenPOWER on IntegriCloud