llvm.org GIT mirror llvm / 2bea947
[PowerPC] Don't mark the return-address slot as immutable It is tempting to mark the fixed stack slot used to store the return address as immutable when lowering @llvm.returnaddress(i32 0). Unfortunately, within the function, it is not completely immutable: it is written during the function prologue. When using post-RA instruction scheduling, the prologue instructions are available for scheduling, and we're not free to interchange the order of a particular store in the prologue with loads from that stack location. Fixes PR21976. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224761 91177308-0d34-0410-b5e6-96231b3b80d8 Hal Finkel 5 years ago
2 changed file(s) with 26 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
51635163 // Find out what the fix offset of the frame pointer save area.
51645164 int LROffset = PPCFrameLowering::getReturnSaveOffset(isPPC64, isDarwinABI);
51655165 // Allocate the frame index for frame pointer save area.
5166 RASI = MF.getFrameInfo()->CreateFixedObject(isPPC64? 8 : 4, LROffset, true);
5166 RASI = MF.getFrameInfo()->CreateFixedObject(isPPC64? 8 : 4, LROffset, false);
51675167 // Save the result.
51685168 FI->setReturnAddrSaveIndex(RASI);
51695169 }
0 ; RUN: llc -mcpu=pwr7 < %s | FileCheck %s
1 target datalayout = "E-m:e-i64:64-n32:64"
2 target triple = "powerpc64-unknown-linux-gnu"
3
4 ; Function Attrs: nounwind readnone
5 define i8* @test1() #0 {
6 entry:
7 %0 = tail call i8* @llvm.returnaddress(i32 0)
8 ret i8* %0
9 }
10
11 ; CHECK-LABEL: @test1
12 ; CHECK: mflr 0
13 ; CHECK: std 0, 16(1)
14 ; FIXME: These next two lines don't both need to load the same value.
15 ; CHECK-DAG: ld 3, 16(1)
16 ; CHECK-DAG: ld 0, 16(1)
17 ; CHECK: mtlr 0
18 ; CHECK: blr
19
20 ; Function Attrs: nounwind readnone
21 declare i8* @llvm.returnaddress(i32) #0
22
23 attributes #0 = { nounwind readnone }
24