[llvm] r218171 - Fix crash with an insertvalue that produces an empty object.
Peter Collingbourne
peter at pcc.me.uk
Fri Sep 19 17:10:48 PDT 2014
Author: pcc
Date: Fri Sep 19 19:10:47 2014
New Revision: 218171
URL: http://llvm.org/viewvc/llvm-project?rev=218171&view=rev
Log:
Fix crash with an insertvalue that produces an empty object.
Added:
llvm/trunk/test/CodeGen/Generic/empty-insertvalue.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=218171&r1=218170&r2=218171&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Fri Sep 19 19:10:47 2014
@@ -3307,6 +3307,12 @@ void SelectionDAGBuilder::visitInsertVal
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.
Added: llvm/trunk/test/CodeGen/Generic/empty-insertvalue.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/empty-insertvalue.ll?rev=218171&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Generic/empty-insertvalue.ll (added)
+++ llvm/trunk/test/CodeGen/Generic/empty-insertvalue.ll Fri Sep 19 19:10:47 2014
@@ -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
+}
More information about the llvm-commits
mailing list