Fix crash with an insertvalue that produces an empty object.

llvm-svn: 218171
This commit is contained in:
Peter Collingbourne 2014-09-20 00:10:47 +00:00
parent d780781b1f
commit 975726345c
2 changed files with 13 additions and 0 deletions

View File

@ -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.

View File

@ -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
}