llvm.org GIT mirror llvm / 91719ef
[ARM] Mark LEApcrel as not having side effects Doing this lets us hoist it out of loops, and I've also marked it as rematerializable the same as the thumb1 and thumb2 counterparts. It looks like it being marked as such was just a mistake, as the commit that made that change only mentions LEApcrelJT and in thumb1 and thumb2 only the LEApcrelJT instructions were marked as having side-effects, so it looks like the intent was to only mark LEApcrelJT as having side-effects but LEApcrel was accidentally marked as such also. Differential Revision: https://reviews.llvm.org/D32857 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303053 91177308-0d34-0410-b5e6-96231b3b80d8 John Brawn 3 years ago
2 changed file(s) with 33 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
22212221 let Inst{11-0} = label{11-0};
22222222 }
22232223
2224 let hasSideEffects = 1 in {
2224 let hasSideEffects = 0, isReMaterializable = 1 in
22252225 def LEApcrel : ARMPseudoInst<(outs GPR:$Rd), (ins i32imm:$label, pred:$p),
22262226 4, IIC_iALUi, []>, Sched<[WriteALU, ReadALU]>;
22272227
2228 let hasSideEffects = 1 in
22282229 def LEApcrelJT : ARMPseudoInst<(outs GPR:$Rd),
22292230 (ins i32imm:$label, pred:$p),
22302231 4, IIC_iALUi, []>, Sched<[WriteALU, ReadALU]>;
2231 }
22322232
22332233 //===----------------------------------------------------------------------===//
22342234 // Control Flow Instructions.
0 ; RUN: llc -mtriple=armv7a %s -o - | FileCheck %s
1 ; RUN: llc -mtriple=thumbv7m %s -o - | FileCheck %s
2 ; RUN: llc -mtriple=thumbv6m %s -o - | FileCheck %s
3
4 @arr = internal unnamed_addr constant [4 x i32] [i32 305419896, i32 -1430532899, i32 -2023406815, i32 -573785174], align 4
5
6 ; Check that the adr of arr is hoisted out of the loop
7 ; CHECK: adr [[REG:r[0-9]+]], .LCP
8 ; CHECK: .LBB
9 ; CHECK-NOT adr
10 ; CHECK: ldr{{(.w)?}} {{r[0-9]+}}, {{\[}}[[REG]],
11
12 define void @fn(i32 %n, i32* %p) {
13 entry:
14 %cmp8 = icmp sgt i32 %n, 0
15 br i1 %cmp8, label %for.body, label %for.cond.cleanup
16
17 for.body:
18 %i.09 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
19 %arrayidx = getelementptr inbounds i32, i32* %p, i32 %i.09
20 %0 = load i32, i32* %arrayidx, align 4
21 %arrayidx1 = getelementptr inbounds [4 x i32], [4 x i32]* @arr, i32 0, i32 %0
22 %1 = load i32, i32* %arrayidx1, align 4
23 store i32 %1, i32* %arrayidx, align 4
24 %inc = add nuw nsw i32 %i.09, 1
25 %exitcond = icmp eq i32 %inc, %n
26 br i1 %exitcond, label %for.cond.cleanup, label %for.body
27
28 for.cond.cleanup:
29 ret void
30 }