[llvm] 028db8c - [Attributor][FIX] Call right base method in AAValueConstantRangeFloating

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 9 22:38:43 PST 2020


Author: Johannes Doerfert
Date: 2020-02-10T00:38:01-06:00
New Revision: 028db8c490bb29fb2fb7fab63771e72923d275fa

URL: https://github.com/llvm/llvm-project/commit/028db8c490bb29fb2fb7fab63771e72923d275fa
DIFF: https://github.com/llvm/llvm-project/commit/028db8c490bb29fb2fb7fab63771e72923d275fa.diff

LOG: [Attributor][FIX] Call right base method in AAValueConstantRangeFloating

We now call the base class method as we should.

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/Attributor.cpp
    llvm/test/Transforms/Attributor/range.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index 5fd34e7c8734..8b97e3d6b1a7 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -6153,7 +6153,7 @@ struct AAValueConstantRangeFloating : AAValueConstantRangeImpl {
 
   /// See AbstractAttribute::initialize(...).
   void initialize(Attributor &A) override {
-    AAValueConstantRange::initialize(A);
+    AAValueConstantRangeImpl::initialize(A);
     Value &V = getAssociatedValue();
 
     if (auto *C = dyn_cast<ConstantInt>(&V)) {

diff  --git a/llvm/test/Transforms/Attributor/range.ll b/llvm/test/Transforms/Attributor/range.ll
index 642f8216d8fd..76ae68885daa 100644
--- a/llvm/test/Transforms/Attributor/range.ll
+++ b/llvm/test/Transforms/Attributor/range.ll
@@ -455,23 +455,32 @@ return:                                           ; preds = %if.else, %if.then
 
 
 define dso_local i32 @test4-g2(i32 %u) {
-; CHECK-LABEL: define {{[^@]+}}@test4-g2
-; CHECK-SAME: (i32 [[U:%.*]])
-; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[CALL:%.*]] = tail call i32 @test4-f2(i32 [[U]])
-; CHECK-NEXT:    ret i32 [[CALL]]
+; OLD_PM-LABEL: define {{[^@]+}}@test4-g2
+; OLD_PM-SAME: (i32 [[U:%.*]])
+; OLD_PM-NEXT:  entry:
+; OLD_PM-NEXT:    [[CALL:%.*]] = tail call i32 @test4-f2(i32 [[U]])
+; OLD_PM-NEXT:    ret i32 [[CALL]]
 ;
-; FIXME: %call should have range [1, inf]
+; NEW_PM-LABEL: define {{[^@]+}}@test4-g2
+; NEW_PM-SAME: (i32 [[U:%.*]])
+; NEW_PM-NEXT:  entry:
+; NEW_PM-NEXT:    [[CALL:%.*]] = tail call i32 @test4-f2(i32 [[U]]) #2, !range !3
+; NEW_PM-NEXT:    ret i32 [[CALL]]
 entry:
   %call = tail call i32 @test4-f2(i32 %u)
   ret i32 %call
 }
 
 define dso_local i32 @test-5() {
-; CHECK-LABEL: define {{[^@]+}}@test-5()
-; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[CALL:%.*]] = call i32 @rec(i32 0), !range !3
-; CHECK-NEXT:    ret i32 [[CALL]]
+; OLD_PM-LABEL: define {{[^@]+}}@test-5()
+; OLD_PM-NEXT:  entry:
+; OLD_PM-NEXT:    [[CALL:%.*]] = call i32 @rec(i32 0), !range !3
+; OLD_PM-NEXT:    ret i32 [[CALL]]
+;
+; NEW_PM-LABEL: define {{[^@]+}}@test-5()
+; NEW_PM-NEXT:  entry:
+; NEW_PM-NEXT:    [[CALL:%.*]] = call i32 @rec(i32 0), !range !4
+; NEW_PM-NEXT:    ret i32 [[CALL]]
 ;
 entry:
   %call = call i32 @rec(i32 0)
@@ -685,7 +694,11 @@ entry:
 
 !0 = !{i32 0, i32 10}
 !1 = !{i32 10, i32 100}
-;CHECK: !0 = !{i32 0, i32 10}
-;CHECK-NEXT: !1 = !{i32 10, i32 100}
-;CHECK-NEXT: !2 = !{i32 200, i32 1091}
+; CHECK: !0 = !{i32 0, i32 10}
+; CHECK-NEXT: !1 = !{i32 10, i32 100}
+; CHECK-NEXT: !2 = !{i32 200, i32 1091}
+; OLD_PM:     !3 = !{i32 0, i32 2}
+; NEW_PM:     !3 = !{i32 1, i32 -2147483648}
+; NEW_PM:     !4 = !{i32 0, i32 2}
+
 


        


More information about the llvm-commits mailing list