Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit 5fb8cf0

Browse files
author
Chen Zheng
committed
[PowerPC] exclude more icmps in LSR which is converted in later hardware loop pass
Differential Revision: https://reviews.llvm.org/D64795 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366976 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 79403eb commit 5fb8cf0

File tree

3 files changed

+6
-13
lines changed

3 files changed

+6
-13
lines changed

lib/Transforms/Scalar/LoopStrengthReduce.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3265,12 +3265,12 @@ void LSRInstance::CollectFixupsAndInitialFormulae() {
32653265
// requirements for both N and i at the same time. Limiting this code to
32663266
// equality icmps is not a problem because all interesting loops use
32673267
// equality icmps, thanks to IndVarSimplify.
3268-
if (ICmpInst *CI = dyn_cast<ICmpInst>(UserInst))
3268+
if (ICmpInst *CI = dyn_cast<ICmpInst>(UserInst)) {
3269+
// If CI can be saved in some target, like replaced inside hardware loop
3270+
// in PowerPC, no need to generate initial formulae for it.
3271+
if (SaveCmp && CI == dyn_cast<ICmpInst>(ExitBranch->getCondition()))
3272+
continue;
32693273
if (CI->isEquality()) {
3270-
// If CI can be saved in some target, like replaced inside hardware loop
3271-
// in PowerPC, no need to generate initial formulae for it.
3272-
if (SaveCmp && CI == dyn_cast<ICmpInst>(ExitBranch->getCondition()))
3273-
continue;
32743274
// Swap the operands if needed to put the OperandValToReplace on the
32753275
// left, for consistency.
32763276
Value *NV = CI->getOperand(1);
@@ -3298,6 +3298,7 @@ void LSRInstance::CollectFixupsAndInitialFormulae() {
32983298
Factors.insert(-(uint64_t)Factors[i]);
32993299
Factors.insert(-1);
33003300
}
3301+
}
33013302

33023303
// Get or create an LSRUse.
33033304
std::pair<size_t, int64_t> P = getUse(S, Kind, AccessTy);

test/CodeGen/PowerPC/ctrloop-le.ll

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v128:128:128-n32:64"
33
target triple = "powerpc64-unknown-linux-gnu"
44

5-
; XFAIL: *
6-
; SE needs improvement
7-
85
; CHECK: test_pos1_ir_sle
96
; CHECK: bdnz
107
; a < b

test/CodeGen/PowerPC/ctrloop-lt.ll

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v128:128:128-n32:64"
33
target triple = "powerpc64-unknown-linux-gnu"
44

5-
; XFAIL: *
6-
; SE needs improvement
7-
85
; CHECK: test_pos1_ir_slt
96
; CHECK: bdnz
107
; a < b
@@ -35,7 +32,6 @@ for.end: ; preds = %for.body, %entry
3532

3633

3734
; CHECK: test_pos2_ir_slt
38-
; FIXME: Support this loop!
3935
; CHECK: bdnz
4036
; a < b
4137
define void @test_pos2_ir_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind {
@@ -65,7 +61,6 @@ for.end: ; preds = %for.body, %entry
6561

6662

6763
; CHECK: test_pos4_ir_slt
68-
; FIXME: Support this loop!
6964
; CHECK: bdnz
7065
; a < b
7166
define void @test_pos4_ir_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind {

0 commit comments

Comments
 (0)