ValueTracking: Implement computeKnownFPClass for arithmetic.fence
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Sun, 9 Apr 2023 11:10:46 +0000 (07:10 -0400)
committerMatt Arsenault <arsenm2@gmail.com>
Fri, 14 Apr 2023 21:41:27 +0000 (17:41 -0400)
llvm/lib/Analysis/ValueTracking.cpp
llvm/test/Transforms/Attributor/nofpclass-arithmetic-fence.ll

index 4a79f52..cad331b 100644 (file)
@@ -4513,6 +4513,11 @@ void computeKnownFPClass(const Value *V, const APInt &DemandedElts,
           Known.knownNot(fcNan);
         break;
       }
+      case Intrinsic::arithmetic_fence: {
+        computeKnownFPClass(II->getArgOperand(0), DemandedElts,
+                            InterestedClasses, Known, Depth + 1, Q, TLI);
+        break;
+      }
       default:
         break;
       }
index e5d97e3..2b2418c 100644 (file)
@@ -14,9 +14,9 @@ define float @ret_arithmetic.fence(float %arg0) {
 }
 
 define float @ret_arithmetic.fence_noinf(float nofpclass(inf) %arg0) {
-; CHECK-LABEL: define float @ret_arithmetic.fence_noinf
+; CHECK-LABEL: define nofpclass(inf) float @ret_arithmetic.fence_noinf
 ; CHECK-SAME: (float nofpclass(inf) [[ARG0:%.*]]) #[[ATTR1]] {
-; CHECK-NEXT:    [[CALL:%.*]] = call float @llvm.arithmetic.fence.f32(float [[ARG0]]) #[[ATTR2]]
+; CHECK-NEXT:    [[CALL:%.*]] = call nofpclass(inf) float @llvm.arithmetic.fence.f32(float [[ARG0]]) #[[ATTR2]]
 ; CHECK-NEXT:    ret float [[CALL]]
 ;
   %call = call float @llvm.arithmetic.fence.f32(float %arg0)
@@ -24,9 +24,9 @@ define float @ret_arithmetic.fence_noinf(float nofpclass(inf) %arg0) {
 }
 
 define float @ret_arithmetic.fence_nopinf(float nofpclass(pinf) %arg0) {
-; CHECK-LABEL: define float @ret_arithmetic.fence_nopinf
+; CHECK-LABEL: define nofpclass(pinf) float @ret_arithmetic.fence_nopinf
 ; CHECK-SAME: (float nofpclass(pinf) [[ARG0:%.*]]) #[[ATTR1]] {
-; CHECK-NEXT:    [[CALL:%.*]] = call float @llvm.arithmetic.fence.f32(float [[ARG0]]) #[[ATTR2]]
+; CHECK-NEXT:    [[CALL:%.*]] = call nofpclass(pinf) float @llvm.arithmetic.fence.f32(float [[ARG0]]) #[[ATTR2]]
 ; CHECK-NEXT:    ret float [[CALL]]
 ;
   %call = call float @llvm.arithmetic.fence.f32(float %arg0)
@@ -34,9 +34,9 @@ define float @ret_arithmetic.fence_nopinf(float nofpclass(pinf) %arg0) {
 }
 
 define float @ret_arithmetic.fence_noninf(float nofpclass(ninf) %arg0) {
-; CHECK-LABEL: define float @ret_arithmetic.fence_noninf
+; CHECK-LABEL: define nofpclass(ninf) float @ret_arithmetic.fence_noninf
 ; CHECK-SAME: (float nofpclass(ninf) [[ARG0:%.*]]) #[[ATTR1]] {
-; CHECK-NEXT:    [[CALL:%.*]] = call float @llvm.arithmetic.fence.f32(float [[ARG0]]) #[[ATTR2]]
+; CHECK-NEXT:    [[CALL:%.*]] = call nofpclass(ninf) float @llvm.arithmetic.fence.f32(float [[ARG0]]) #[[ATTR2]]
 ; CHECK-NEXT:    ret float [[CALL]]
 ;
   %call = call float @llvm.arithmetic.fence.f32(float %arg0)
@@ -44,9 +44,9 @@ define float @ret_arithmetic.fence_noninf(float nofpclass(ninf) %arg0) {
 }
 
 define float @ret_arithmetic.fence_nonan(float nofpclass(nan) %arg0) {
-; CHECK-LABEL: define float @ret_arithmetic.fence_nonan
+; CHECK-LABEL: define nofpclass(nan) float @ret_arithmetic.fence_nonan
 ; CHECK-SAME: (float nofpclass(nan) [[ARG0:%.*]]) #[[ATTR1]] {
-; CHECK-NEXT:    [[CALL:%.*]] = call float @llvm.arithmetic.fence.f32(float [[ARG0]]) #[[ATTR2]]
+; CHECK-NEXT:    [[CALL:%.*]] = call nofpclass(nan) float @llvm.arithmetic.fence.f32(float [[ARG0]]) #[[ATTR2]]
 ; CHECK-NEXT:    ret float [[CALL]]
 ;
   %call = call float @llvm.arithmetic.fence.f32(float %arg0)
@@ -54,9 +54,9 @@ define float @ret_arithmetic.fence_nonan(float nofpclass(nan) %arg0) {
 }
 
 define float @ret_arithmetic.fence_noqnan(float nofpclass(qnan) %arg0) {
-; CHECK-LABEL: define float @ret_arithmetic.fence_noqnan
+; CHECK-LABEL: define nofpclass(qnan) float @ret_arithmetic.fence_noqnan
 ; CHECK-SAME: (float nofpclass(qnan) [[ARG0:%.*]]) #[[ATTR1]] {
-; CHECK-NEXT:    [[CALL:%.*]] = call float @llvm.arithmetic.fence.f32(float [[ARG0]]) #[[ATTR2]]
+; CHECK-NEXT:    [[CALL:%.*]] = call nofpclass(qnan) float @llvm.arithmetic.fence.f32(float [[ARG0]]) #[[ATTR2]]
 ; CHECK-NEXT:    ret float [[CALL]]
 ;
   %call = call float @llvm.arithmetic.fence.f32(float %arg0)
@@ -64,9 +64,9 @@ define float @ret_arithmetic.fence_noqnan(float nofpclass(qnan) %arg0) {
 }
 
 define float @ret_arithmetic.fence_nosnan(float nofpclass(snan) %arg0) {
-; CHECK-LABEL: define float @ret_arithmetic.fence_nosnan
+; CHECK-LABEL: define nofpclass(snan) float @ret_arithmetic.fence_nosnan
 ; CHECK-SAME: (float nofpclass(snan) [[ARG0:%.*]]) #[[ATTR1]] {
-; CHECK-NEXT:    [[CALL:%.*]] = call float @llvm.arithmetic.fence.f32(float [[ARG0]]) #[[ATTR2]]
+; CHECK-NEXT:    [[CALL:%.*]] = call nofpclass(snan) float @llvm.arithmetic.fence.f32(float [[ARG0]]) #[[ATTR2]]
 ; CHECK-NEXT:    ret float [[CALL]]
 ;
   %call = call float @llvm.arithmetic.fence.f32(float %arg0)
@@ -74,9 +74,9 @@ define float @ret_arithmetic.fence_nosnan(float nofpclass(snan) %arg0) {
 }
 
 define float @ret_arithmetic.fence_nozero(float nofpclass(zero) %arg0) {
-; CHECK-LABEL: define float @ret_arithmetic.fence_nozero
+; CHECK-LABEL: define nofpclass(zero) float @ret_arithmetic.fence_nozero
 ; CHECK-SAME: (float nofpclass(zero) [[ARG0:%.*]]) #[[ATTR1]] {
-; CHECK-NEXT:    [[CALL:%.*]] = call float @llvm.arithmetic.fence.f32(float [[ARG0]]) #[[ATTR2]]
+; CHECK-NEXT:    [[CALL:%.*]] = call nofpclass(zero) float @llvm.arithmetic.fence.f32(float [[ARG0]]) #[[ATTR2]]
 ; CHECK-NEXT:    ret float [[CALL]]
 ;
   %call = call float @llvm.arithmetic.fence.f32(float %arg0)
@@ -84,9 +84,9 @@ define float @ret_arithmetic.fence_nozero(float nofpclass(zero) %arg0) {
 }
 
 define float @ret_arithmetic.fence_nopzero(float nofpclass(pzero) %arg0) {
-; CHECK-LABEL: define float @ret_arithmetic.fence_nopzero
+; CHECK-LABEL: define nofpclass(pzero) float @ret_arithmetic.fence_nopzero
 ; CHECK-SAME: (float nofpclass(pzero) [[ARG0:%.*]]) #[[ATTR1]] {
-; CHECK-NEXT:    [[CALL:%.*]] = call float @llvm.arithmetic.fence.f32(float [[ARG0]]) #[[ATTR2]]
+; CHECK-NEXT:    [[CALL:%.*]] = call nofpclass(pzero) float @llvm.arithmetic.fence.f32(float [[ARG0]]) #[[ATTR2]]
 ; CHECK-NEXT:    ret float [[CALL]]
 ;
   %call = call float @llvm.arithmetic.fence.f32(float %arg0)
@@ -94,9 +94,9 @@ define float @ret_arithmetic.fence_nopzero(float nofpclass(pzero) %arg0) {
 }
 
 define float @ret_arithmetic.fence_nonzero(float nofpclass(nzero) %arg0) {
-; CHECK-LABEL: define float @ret_arithmetic.fence_nonzero
+; CHECK-LABEL: define nofpclass(nzero) float @ret_arithmetic.fence_nonzero
 ; CHECK-SAME: (float nofpclass(nzero) [[ARG0:%.*]]) #[[ATTR1]] {
-; CHECK-NEXT:    [[CALL:%.*]] = call float @llvm.arithmetic.fence.f32(float [[ARG0]]) #[[ATTR2]]
+; CHECK-NEXT:    [[CALL:%.*]] = call nofpclass(nzero) float @llvm.arithmetic.fence.f32(float [[ARG0]]) #[[ATTR2]]
 ; CHECK-NEXT:    ret float [[CALL]]
 ;
   %call = call float @llvm.arithmetic.fence.f32(float %arg0)
@@ -104,9 +104,9 @@ define float @ret_arithmetic.fence_nonzero(float nofpclass(nzero) %arg0) {
 }
 
 define float @ret_arithmetic.fence_nonorm(float nofpclass(norm) %arg0) {
-; CHECK-LABEL: define float @ret_arithmetic.fence_nonorm
+; CHECK-LABEL: define nofpclass(norm) float @ret_arithmetic.fence_nonorm
 ; CHECK-SAME: (float nofpclass(norm) [[ARG0:%.*]]) #[[ATTR1]] {
-; CHECK-NEXT:    [[CALL:%.*]] = call float @llvm.arithmetic.fence.f32(float [[ARG0]]) #[[ATTR2]]
+; CHECK-NEXT:    [[CALL:%.*]] = call nofpclass(norm) float @llvm.arithmetic.fence.f32(float [[ARG0]]) #[[ATTR2]]
 ; CHECK-NEXT:    ret float [[CALL]]
 ;
   %call = call float @llvm.arithmetic.fence.f32(float %arg0)