llvm.org GIT mirror llvm / f1d3d66
Handle getresult instructions in different basic blocks from their aggregate operands by moving the getresult instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48657 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 11 years ago
2 changed file(s) with 24 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
11261126 // Sink address computing for memory operands into the block.
11271127 MadeChange |= OptimizeInlineAsmInst(I, &(*CI), SunkAddrs);
11281128 }
1129 } else if (GetResultInst *GRI = dyn_cast(I)) {
1130 // Ensure that all getresult instructions live in the same basic block
1131 // as their associated struct-value instructions. Codegen requires
1132 // this, as lowering only works on one basic block at a time.
1133 if (Instruction *Agg = dyn_cast(GRI->getAggregateValue())) {
1134 BasicBlock *AggBB = Agg->getParent();
1135 if (AggBB != GRI->getParent())
1136 GRI->moveBefore(AggBB->getTerminator());
1137 }
11291138 }
11301139 }
11311140
0 ; RUN: llvm-as < %s | llc -march=x86
1
2 declare {x86_fp80, x86_fp80} @test()
3
4 define void @call2(x86_fp80 *%P1, x86_fp80 *%P2) {
5 %a = call {x86_fp80,x86_fp80} @test()
6 %b = getresult {x86_fp80,x86_fp80} %a, 1
7 store x86_fp80 %b, x86_fp80* %P1
8 br label %L
9
10 L:
11 %c = getresult {x86_fp80,x86_fp80} %a, 0
12 store x86_fp80 %c, x86_fp80* %P2
13 ret void
14 }