Changeset View
Changeset View
Standalone View
Standalone View
llvm/test/Other/loop-deletion-printer.ll
; Make sure that Loop which was invalidated by loop-deletion | ; Make sure that Loop which was invalidated by loop-deletion | ||||
; does not lead to problems for -print-after-all and is just skipped. | ; does not lead to problems for -print-after-all and is just skipped. | ||||
; | ; | ||||
; RUN: opt < %s -disable-output \ | ; RUN: opt < %s -disable-output \ | ||||
; RUN: -passes=loop-instsimplify -print-after-all 2>&1 | FileCheck %s -check-prefix=SIMPLIFY | ; RUN: -passes=loop-instsimplify -print-after-all 2>&1 | FileCheck %s -check-prefix=SIMPLIFY | ||||
; RUN: opt < %s -disable-output \ | ; RUN: opt < %s -disable-output \ | ||||
; RUN: -passes=loop-deletion,loop-instsimplify -print-after-all 2>&1 | FileCheck %s -check-prefix=DELETED | ; RUN: -passes=loop-deletion,loop-instsimplify -print-after-all 2>&1 | FileCheck %s -check-prefix=DELETED | ||||
; RUN: opt < %s -disable-output \ | ; RUN: opt < %s -disable-output \ | ||||
; RUN: -passes=loop-deletion,loop-instsimplify -print-after-all -print-module-scope 2>&1 | FileCheck %s -check-prefix=DELETED-BUT-PRINTED | ; RUN: -passes=loop-deletion,loop-instsimplify -print-after-all -print-module-scope 2>&1 | FileCheck %s -check-prefix=DELETED-BUT-PRINTED | ||||
; | ; | ||||
; SIMPLIFY: IR Dump {{.*}} LoopInstSimplifyPass | ; SIMPLIFY: IR Dump {{.*}} LoopInstSimplifyPass | ||||
; DELETED-NOT: IR Dump {{.*}}LoopInstSimplifyPass | ; DELETED-NOT: IR Dump {{.*}}LoopInstSimplifyPass | ||||
; DELETED-NOT: IR Dump {{.*}}LoopDeletionPass | ; DELETED-NOT: IR Dump {{.*}}LoopDeletionPass | ||||
; DELETED-BUT-PRINTED: IR Dump {{.*}}LoopDeletionPass {{.*invalidated:}} | ; DELETED-BUT-PRINTED: IR Dump {{.*}}LoopDeletionPass {{.*invalidated:}} | ||||
; DELETED-BUT-PRINTED-NOT: IR Dump {{.*}}LoopInstSimplifyPass | ; DELETED-BUT-PRINTED-NOT: IR Dump {{.*}}LoopInstSimplifyPass | ||||
define void @deleteme() { | define void @deleteme() willreturn { | ||||
fhahn: Is this change related to the patch? Same for the other test changes that just add `willreturn`? | |||||
atmnpatelAuthorUnsubmitted Not Done ReplyInline ActionsYep, if these test functions aren't marked willreturn, we won't delete the loop because it could be a legal infinite loop from C/C++. atmnpatel: Yep, if these test functions aren't marked willreturn, we won't delete the loop because it… | |||||
fhahnUnsubmitted Not Done ReplyInline ActionsI don't think that is the case here. The trip count of the loop here is constant, so it cannot be infinite. Also, the existing code already removes the loop, without willreturn, as implied by no changes to the check lines? I did not check all other cases, but I would expect that willreturn does not need to be added to cases where the trip count is a known constant and that already get removed. fhahn: I don't think that is the case here. The trip count of the loop here is constant, so it cannot… | |||||
entry: | entry: | ||||
br label %loop | br label %loop | ||||
loop: | loop: | ||||
%iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ] | %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ] | ||||
%iv.next = add i32 %iv, 1 | %iv.next = add i32 %iv, 1 | ||||
%check = icmp ult i32 %iv.next, 3 | %check = icmp ult i32 %iv.next, 3 | ||||
br i1 %check, label %loop, label %exit | br i1 %check, label %loop, label %exit | ||||
exit: | exit: | ||||
ret void | ret void | ||||
} | } | ||||
Is this change related to the patch? Same for the other test changes that just add willreturn?