[llvm] d3ac92f - [GlobalOpt] Regenerate test checks (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 2 08:08:35 PST 2023


Author: Nikita Popov
Date: 2023-03-02T17:07:58+01:00
New Revision: d3ac92f1e12c0420a2fe73f554851f9f866ebf88

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

LOG: [GlobalOpt] Regenerate test checks (NFC)

And drop the unnecessary main function.

Added: 
    

Modified: 
    llvm/test/Transforms/GlobalOpt/global-demotion.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/GlobalOpt/global-demotion.ll b/llvm/test/Transforms/GlobalOpt/global-demotion.ll
index f29d4bd48421..bceadea518d3 100644
--- a/llvm/test/Transforms/GlobalOpt/global-demotion.ll
+++ b/llvm/test/Transforms/GlobalOpt/global-demotion.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
 ; RUN: opt -passes=globalopt -S < %s | FileCheck %s
 
 @G1 = internal global i32 5
@@ -6,72 +7,73 @@
 @G4 = internal global i32 5
 @G5 = internal global i32 5
 
-; CHECK-LABEL: @test1
-define internal i32 @test1() norecurse {
-; CHECK-NOT: @G1
+define i32 @test1() norecurse {
+; CHECK-LABEL: @test1(
+; CHECK-NEXT:    [[G1:%.*]] = alloca i32, align 4
+; CHECK-NEXT:    store i32 5, ptr [[G1]], align 4
+; CHECK-NEXT:    store i32 4, ptr [[G1]], align 4
+; CHECK-NEXT:    [[A:%.*]] = load i32, ptr [[G1]], align 4
+; CHECK-NEXT:    ret i32 [[A]]
+;
   store i32 4, ptr @G1
   %a = load i32, ptr @G1
-; CHECK: ret
   ret i32 %a
 }
 
 ; The load comes before the store which makes @G2 live before the call.
-; CHECK-LABEL: @test2
-define internal i32 @test2() norecurse {
-; CHECK-NOT: %G2
+define i32 @test2() norecurse {
+; CHECK-LABEL: @test2(
+; CHECK-NEXT:    [[A_B:%.*]] = load i1, ptr @G2, align 1
+; CHECK-NEXT:    [[A:%.*]] = select i1 [[A_B]], i32 4, i32 5
+; CHECK-NEXT:    store i1 true, ptr @G2, align 1
+; CHECK-NEXT:    ret i32 [[A]]
+;
   %a = load i32, ptr @G2
   store i32 4, ptr @G2
-; CHECK: ret
   ret i32 %a
 }
 
 ; This global is indexed by a GEP - this makes it partial alias and we bail out.
 ; FIXME: We don't actually have to bail out in this case.
-
-; CHECK-LABEL: @test3
-define internal i32 @test3() norecurse {
-; CHECK-NOT: %G3
+define i32 @test3() norecurse {
+; CHECK-LABEL: @test3(
+; CHECK-NEXT:    [[A_B:%.*]] = load i1, ptr @G3, align 1
+; CHECK-NEXT:    [[A:%.*]] = select i1 [[A_B]], i32 4, i32 5
+; CHECK-NEXT:    store i1 true, ptr @G3, align 1
+; CHECK-NEXT:    ret i32 [[A]]
+;
   %a = load i32, ptr @G3
   store i32 4, ptr @G3
-; CHECK: ret
   ret i32 %a
 }
 
 ; The global is casted away to a larger type then loaded. The store only partially
 ; covers the load, so we must not demote.
-
-; CHECK-LABEL: @test4
-define internal i32 @test4() norecurse {
-; CHECK-NOT: %G4
+define i32 @test4() norecurse {
+; CHECK-LABEL: @test4(
+; CHECK-NEXT:    store i32 4, ptr @G4, align 4
+; CHECK-NEXT:    [[A:%.*]] = load i64, ptr @G4, align 4
+; CHECK-NEXT:    [[B:%.*]] = trunc i64 [[A]] to i32
+; CHECK-NEXT:    ret i32 [[B]]
+;
   store i32 4, ptr @G4
   %a = load i64, ptr @G4
   %b = trunc i64 %a to i32
-; CHECK: ret
   ret i32 %b
 }
 
 ; The global is casted away to a smaller type then loaded. This one is fine.
-
-; CHECK-LABEL: @test5
-define internal i32 @test5() norecurse {
-; CHECK-NOT: @G5
+define i32 @test5() norecurse {
+; CHECK-LABEL: @test5(
+; CHECK-NEXT:    [[G5:%.*]] = alloca i32, align 4
+; CHECK-NEXT:    store i32 5, ptr [[G5]], align 4
+; CHECK-NEXT:    store i32 4, ptr [[G5]], align 4
+; CHECK-NEXT:    [[A:%.*]] = load i16, ptr [[G5]], align 2
+; CHECK-NEXT:    [[B:%.*]] = zext i16 [[A]] to i32
+; CHECK-NEXT:    ret i32 [[B]]
+;
   store i32 4, ptr @G5
   %a = load i16, ptr @G5
   %b = zext i16 %a to i32
-; CHECK: ret
   ret i32 %b
 }
-
-define i32 @main() norecurse {
-  %a = call i32 @test1()
-  %b = call i32 @test2()
-  %c = call i32 @test3()
-  %d = call i32 @test4()
-  %e = call i32 @test5()
-
-  %x = or i32 %a, %b
-  %y = or i32 %x, %c
-  %z = or i32 %y, %d
-  %w = or i32 %z, %e
-  ret i32 %w
-}


        


More information about the llvm-commits mailing list