llvm.org GIT mirror
[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).
 1879 1879 // Diamond: TBB is the block that is branched to, FBB is the fallthrough 1880 1880 TUnpredCycles = TCycles + TakenBranchCost; 1881 1881 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; 1882 1885 } 1883 1886 // The total cost is the cost of each path scaled by their probabilites 1884 1887 unsigned TUnpredCost = Probability.scale(TUnpredCycles * ScalingUpFactor);
 94 94 } 95 95 96 96 ; 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 106 108 define i32 @diamond2(i32 %n, i32 %m, i32* %p, i32* %q) { 107 109 entry: 108 110 %tobool = icmp eq i32 %n, 0 110 112 111 113 if.then: 112 114 store i32 %n, i32* %p, align 4 115 %arrayidx = getelementptr inbounds i32, i32* %p, i32 2 116 store i32 %n, i32* %arrayidx, align 4 113 117 br label %if.end 114 118 115 119 if.else: