llvm.org GIT mirror llvm / ec26641
[ARM] Adjust ifcvt heuristic for the diamond ifcvt case When we have a diamond ifcvt the fallthough block will have a branch at the end of it that disappears when predicated, so discount it from the predication cost. Differential Revision: https://reviews.llvm.org/D34952 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307788 91177308-0d34-0410-b5e6-96231b3b80d8 John Brawn 3 years ago
2 changed file(s) with 16 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
18791879 // Diamond: TBB is the block that is branched to, FBB is the fallthrough
18801880 TUnpredCycles = TCycles + TakenBranchCost;
18811881 FUnpredCycles = FCycles + NotTakenBranchCost;
1882 // The branch at the end of FBB will disappear when it's predicated, so
1883 // discount it from PredCost.
1884 PredCost -= 1 * ScalingUpFactor;
18821885 }
18831886 // The total cost is the cost of each path scaled by their probabilites
18841887 unsigned TUnpredCost = Probability.scale(TUnpredCycles * ScalingUpFactor);
9494 }
9595
9696 ; CHECK-LABEL: diamond2:
97 ; CHECK-BP: itte
98 ; CHECK-BP: streq
99 ; CHECK-BP: ldreq
100 ; CHECK-BP: strne
101 ; CHECK-NOBP: cbz
102 ; CHECK-NOBP: str
103 ; CHECK-NOBP: b
104 ; CHECK-NOBP: str
105 ; CHECK-NOBP: ldr
97 ; CHECK-BP: cbz
98 ; CHECK-BP: str
99 ; CHECK-BP: str
100 ; CHECK-BP: b
101 ; CHECK-BP: str
102 ; CHECK-BP: ldr
103 ; CHECK-NOBP: ittee
104 ; CHECK-NOBP: streq
105 ; CHECK-NOBP: ldreq
106 ; CHECK-NOBP: strne
107 ; CHECK-NOBP: strne
106108 define i32 @diamond2(i32 %n, i32 %m, i32* %p, i32* %q) {
107109 entry:
108110 %tobool = icmp eq i32 %n, 0
110112
111113 if.then:
112114 store i32 %n, i32* %p, align 4
115 %arrayidx = getelementptr inbounds i32, i32* %p, i32 2
116 store i32 %n, i32* %arrayidx, align 4
113117 br label %if.end
114118
115119 if.else: