Skip to content

Commit

Permalink
[NFC]][PowerPC] Remove unused intrinsic for old CTR loop pass
Browse files Browse the repository at this point in the history
Summary:

In the patch D62907 the PPC CTRLoops pass has been replaced by Generic
Hardware Loop pass, and it has imported some new intrinsic for Generic
Hardware Loop.

The old intrinsic used in PPC CTRLoops int_ppc_mtctr and
int_ppc_is_decremented_ctr_nonzero is been replaced by
int_set_loop_iterations and loop_decrement.

This patch is to remove above unused two instrinsic.

Reviewed By: shchenz

Differential Revision: https://reviews.llvm.org/D81539
  • Loading branch information
zhangkangcool committed Jun 17, 2020
1 parent 564821a commit c2574dc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
9 changes: 0 additions & 9 deletions llvm/include/llvm/IR/IntrinsicsPowerPC.td
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,6 @@ let TargetPrefix = "ppc" in { // All intrinsics start with "llvm.ppc.".
// eieio instruction
def int_ppc_eieio : Intrinsic<[],[],[]>;

// Intrinsics used to generate ctr-based loops. These should only be
// generated by the PowerPC backend!
// The branch intrinsic is marked as NoDuplicate because loop rotation will
// attempt to duplicate it forming loops where a block reachable from one
// instance of it can contain another.
def int_ppc_mtctr : Intrinsic<[], [llvm_anyint_ty], []>;
def int_ppc_is_decremented_ctr_nonzero :
Intrinsic<[llvm_i1_ty], [], [IntrNoDuplicate]>;

// Intrinsics for [double]word extended forms of divide instructions
def int_ppc_divwe : GCCBuiltin<"__builtin_divwe">,
Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty],
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ bool PPCTTIImpl::mightUseCTR(BasicBlock *BB, TargetLibraryInfo *LibInfo,
if (F->getIntrinsicID() != Intrinsic::not_intrinsic) {
switch (F->getIntrinsicID()) {
default: continue;
// If we have a call to ppc_is_decremented_ctr_nonzero, or ppc_mtctr
// If we have a call to loop_decrement or set_loop_iterations,
// we're definitely using CTR.
case Intrinsic::set_loop_iterations:
case Intrinsic::loop_decrement:
Expand Down
16 changes: 8 additions & 8 deletions llvm/test/CodeGen/PowerPC/no-dup-of-bdnz.ll
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ target triple = "powerpc64le-unknown-linux-gnu"

define void @test(i64 %arg.ssa, i64 %arg.nb) local_unnamed_addr {
; Ensure that loop rotation doesn't duplicate the call to
; llvm.ppc.is.decremented.ctr.nonzero
; llvm.loop.decrement
; CHECK-LABEL: test
; CHECK: call i1 @llvm.ppc.is.decremented.ctr.nonzero
; CHECK-NOT: call i1 @llvm.ppc.is.decremented.ctr.nonzero
; CHECK: declare i1 @llvm.ppc.is.decremented.ctr.nonzero
; CHECK: call i1 @llvm.loop.decrement
; CHECK-NOT: call i1 @llvm.loop.decrement
; CHECK: declare i1 @llvm.loop.decrement
entry:
switch i32 undef, label %BB_8 [
i32 -2, label %BB_9
Expand All @@ -31,7 +31,7 @@ BB_2: ; preds = %BB_1
BB_3: ; preds = %BB_1
%1 = add i64 %arg.ssa, %bcount.1.us
%2 = add i64 %1, 1
%3 = call i1 @llvm.ppc.is.decremented.ctr.nonzero()
%3 = call i1 @llvm.loop.decrement.i32(i32 1)
br i1 %3, label %BB_4, label %BB_7

BB_4: ; preds = %BB_3
Expand Down Expand Up @@ -62,14 +62,14 @@ BB_11: ; preds = %BB_11, %BB_10
br i1 undef, label %BB_11, label %BB_12

BB_12: ; preds = %BB_11
call void @llvm.ppc.mtctr.i64(i64 %arg.nb)
call void @llvm.set.loop.iterations.i64(i64 %arg.nb)
br label %BB_1
}

; Function Attrs: nounwind
declare void @llvm.ppc.mtctr.i64(i64) #0
declare void @llvm.set.loop.iterations.i64(i64) #0

; Function Attrs: nounwind
declare i1 @llvm.ppc.is.decremented.ctr.nonzero() #0
declare i1 @llvm.loop.decrement.i32(i32) #0

attributes #0 = { nounwind }

0 comments on commit c2574dc

Please sign in to comment.