Skip to content

Commit

Permalink
[Attributor] Add nofpclass test for phi+select recurrences. NFC
Browse files Browse the repository at this point in the history
  • Loading branch information
davemgreen committed Oct 30, 2024
1 parent 9c8dab0 commit f358422
Showing 1 changed file with 176 additions and 0 deletions.
176 changes: 176 additions & 0 deletions llvm/test/Transforms/Attributor/nofpclass-phiselect.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -S < %s | FileCheck %s

define float @phi_select(i1 %c, float nofpclass(inf) %base, float nofpclass(inf) %arg) {
; CHECK-LABEL: define float @phi_select
; CHECK-SAME: (i1 [[C:%.*]], float nofpclass(inf) [[BASE:%.*]], float nofpclass(inf) [[ARG:%.*]]) #[[ATTR0:[0-9]+]] {
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
; CHECK: loop:
; CHECK-NEXT: [[PHI:%.*]] = phi float [ [[BASE]], [[ENTRY:%.*]] ], [ [[SELECT:%.*]], [[LOOP]] ]
; CHECK-NEXT: [[SELECT]] = select i1 [[C]], float [[PHI]], float [[ARG]]
; CHECK-NEXT: br i1 [[C]], label [[LOOP]], label [[EXIT:%.*]]
; CHECK: exit:
; CHECK-NEXT: ret float [[SELECT]]
;
entry:
br label %loop

loop:
%phi = phi float [ %base, %entry ], [ %select, %loop ]
%select = select i1 %c, float %phi, float %arg
br i1 %c, label %loop, label %exit

exit:
ret float %select
}

define float @phi_select_onlybase(i1 %c, float nofpclass(inf) %base, float %arg) {
; CHECK-LABEL: define float @phi_select_onlybase
; CHECK-SAME: (i1 [[C:%.*]], float nofpclass(inf) [[BASE:%.*]], float [[ARG:%.*]]) #[[ATTR0]] {
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
; CHECK: loop:
; CHECK-NEXT: [[PHI:%.*]] = phi float [ [[BASE]], [[ENTRY:%.*]] ], [ [[SELECT:%.*]], [[LOOP]] ]
; CHECK-NEXT: [[SELECT]] = select i1 [[C]], float [[PHI]], float [[ARG]]
; CHECK-NEXT: br i1 [[C]], label [[LOOP]], label [[EXIT:%.*]]
; CHECK: exit:
; CHECK-NEXT: ret float [[SELECT]]
;
entry:
br label %loop

loop:
%phi = phi float [ %base, %entry ], [ %select, %loop ]
%select = select i1 %c, float %phi, float %arg
br i1 %c, label %loop, label %exit

exit:
ret float %select
}

define float @phi_select_onlyarg(i1 %c, float %base, float nofpclass(inf) %arg) {
; CHECK-LABEL: define float @phi_select_onlyarg
; CHECK-SAME: (i1 [[C:%.*]], float [[BASE:%.*]], float nofpclass(inf) [[ARG:%.*]]) #[[ATTR0]] {
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
; CHECK: loop:
; CHECK-NEXT: [[PHI:%.*]] = phi float [ [[BASE]], [[ENTRY:%.*]] ], [ [[SELECT:%.*]], [[LOOP]] ]
; CHECK-NEXT: [[SELECT]] = select i1 [[C]], float [[PHI]], float [[ARG]]
; CHECK-NEXT: br i1 [[C]], label [[LOOP]], label [[EXIT:%.*]]
; CHECK: exit:
; CHECK-NEXT: ret float [[SELECT]]
;
entry:
br label %loop

loop:
%phi = phi float [ %base, %entry ], [ %select, %loop ]
%select = select i1 %c, float %phi, float %arg
br i1 %c, label %loop, label %exit

exit:
ret float %select
}

define float @phi_phi(i1 %c, float nofpclass(inf) %base, float nofpclass(inf) %arg) {
; CHECK-LABEL: define float @phi_phi
; CHECK-SAME: (i1 [[C:%.*]], float nofpclass(inf) [[BASE:%.*]], float nofpclass(inf) [[ARG:%.*]]) #[[ATTR0]] {
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
; CHECK: loop:
; CHECK-NEXT: [[PHI:%.*]] = phi float [ [[BASE]], [[ENTRY:%.*]] ], [ [[PHI2:%.*]], [[EXIT1:%.*]] ]
; CHECK-NEXT: br label [[INNER:%.*]]
; CHECK: inner:
; CHECK-NEXT: [[PHI2]] = phi float [ [[PHI]], [[LOOP]] ], [ [[ARG]], [[INNER]] ]
; CHECK-NEXT: br i1 [[C]], label [[INNER]], label [[EXIT1]]
; CHECK: exit1:
; CHECK-NEXT: br i1 [[C]], label [[LOOP]], label [[EXIT:%.*]]
; CHECK: exit:
; CHECK-NEXT: ret float [[PHI2]]
;
entry:
br label %loop

loop:
%phi = phi float [ %base, %entry ], [ %phi2, %exit1 ]
br label %inner

inner:
%phi2 = phi float [ %phi, %loop ], [ %arg, %inner ]
br i1 %c, label %inner, label %exit1

exit1:
br i1 %c, label %loop, label %exit

exit:
ret float %phi2
}

define float @phi_phi_onlybase(i1 %c, float nofpclass(inf) %base, float %arg) {
; CHECK-LABEL: define float @phi_phi_onlybase
; CHECK-SAME: (i1 [[C:%.*]], float nofpclass(inf) [[BASE:%.*]], float [[ARG:%.*]]) #[[ATTR0]] {
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
; CHECK: loop:
; CHECK-NEXT: [[PHI:%.*]] = phi float [ [[BASE]], [[ENTRY:%.*]] ], [ [[PHI2:%.*]], [[EXIT1:%.*]] ]
; CHECK-NEXT: br label [[INNER:%.*]]
; CHECK: inner:
; CHECK-NEXT: [[PHI2]] = phi float [ [[PHI]], [[LOOP]] ], [ [[ARG]], [[INNER]] ]
; CHECK-NEXT: br i1 [[C]], label [[INNER]], label [[EXIT1]]
; CHECK: exit1:
; CHECK-NEXT: br i1 [[C]], label [[LOOP]], label [[EXIT:%.*]]
; CHECK: exit:
; CHECK-NEXT: ret float [[PHI2]]
;
entry:
br label %loop

loop:
%phi = phi float [ %base, %entry ], [ %phi2, %exit1 ]
br label %inner

inner:
%phi2 = phi float [ %phi, %loop ], [ %arg, %inner ]
br i1 %c, label %inner, label %exit1

exit1:
br i1 %c, label %loop, label %exit

exit:
ret float %phi2
}

define float @phi_phi_onlyarg(i1 %c, float %base, float nofpclass(inf) %arg) {
; CHECK-LABEL: define float @phi_phi_onlyarg
; CHECK-SAME: (i1 [[C:%.*]], float [[BASE:%.*]], float nofpclass(inf) [[ARG:%.*]]) #[[ATTR0]] {
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
; CHECK: loop:
; CHECK-NEXT: [[PHI:%.*]] = phi float [ [[BASE]], [[ENTRY:%.*]] ], [ [[PHI2:%.*]], [[EXIT1:%.*]] ]
; CHECK-NEXT: br label [[INNER:%.*]]
; CHECK: inner:
; CHECK-NEXT: [[PHI2]] = phi float [ [[PHI]], [[LOOP]] ], [ [[ARG]], [[INNER]] ]
; CHECK-NEXT: br i1 [[C]], label [[INNER]], label [[EXIT1]]
; CHECK: exit1:
; CHECK-NEXT: br i1 [[C]], label [[LOOP]], label [[EXIT:%.*]]
; CHECK: exit:
; CHECK-NEXT: ret float [[PHI2]]
;
entry:
br label %loop

loop:
%phi = phi float [ %base, %entry ], [ %phi2, %exit1 ]
br label %inner

inner:
%phi2 = phi float [ %phi, %loop ], [ %arg, %inner ]
br i1 %c, label %inner, label %exit1

exit1:
br i1 %c, label %loop, label %exit

exit:
ret float %phi2
}

0 comments on commit f358422

Please sign in to comment.