llvm.org GIT mirror llvm / 90d33ee
Don't look for leaf values to store when lowering stores of empty structs. This fixes PR2612. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54226 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 11 years ago
2 changed file(s) with 24 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
29272927
29282928 void SelectionDAGLowering::visitStore(StoreInst &I) {
29292929 Value *SrcV = I.getOperand(0);
2930 SDValue Src = getValue(SrcV);
29312930 Value *PtrV = I.getOperand(1);
2932 SDValue Ptr = getValue(PtrV);
29332931
29342932 SmallVector ValueVTs;
29352933 SmallVector Offsets;
29372935 unsigned NumValues = ValueVTs.size();
29382936 if (NumValues == 0)
29392937 return;
2938
2939 // Get the lowered operands. Note that we do this after
2940 // checking if NumResults is zero, because with zero results
2941 // the operands won't have values in the map.
2942 SDValue Src = getValue(SrcV);
2943 SDValue Ptr = getValue(PtrV);
29402944
29412945 SDValue Root = getRoot();
29422946 SmallVector Chains(NumValues);
0 ; RUN: llvm-as < %s | llc
1 ; PR2612
2
3 @current_foo = internal global { } zeroinitializer
4
5 define i32 @foo() {
6 entry:
7 %retval = alloca i32
8 store i32 0, i32* %retval
9 %local_foo = alloca { }
10 load { }* @current_foo
11 store { } %0, { }* %local_foo
12 br label %return
13
14 return:
15 load i32* %retval
16 ret i32 %1
17 }