-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FunctionAttrs] Regenerate test checks (NFC)
- Loading branch information
Showing
7 changed files
with
232 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,24 @@ | ||
; RUN: opt < %s -function-attrs -S | FileCheck %s | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes | ||
; RUN: opt < %s -passes=function-attrs -S | FileCheck %s | ||
|
||
; CHECK: Function Attrs | ||
; CHECK-SAME: readnone | ||
; CHECK-NEXT: define i32 @a | ||
define i32 @a() { | ||
%tmp = call i32 @b( ) ; <i32> [#uses=1] | ||
ret i32 %tmp | ||
; CHECK: Function Attrs: nofree nosync nounwind readnone | ||
; CHECK-LABEL: define {{[^@]+}}@a | ||
; CHECK-SAME: () #[[ATTR0:[0-9]+]] { | ||
; CHECK-NEXT: [[TMP:%.*]] = call i32 @b() | ||
; CHECK-NEXT: ret i32 [[TMP]] | ||
; | ||
%tmp = call i32 @b() | ||
ret i32 %tmp | ||
} | ||
|
||
; CHECK: Function Attrs | ||
; CHECK-SAME: readnone | ||
; CHECK-NEXT: define i32 @b | ||
define i32 @b() { | ||
%tmp = call i32 @a( ) ; <i32> [#uses=1] | ||
ret i32 %tmp | ||
; CHECK: Function Attrs: nofree nosync nounwind readnone | ||
; CHECK-LABEL: define {{[^@]+}}@b | ||
; CHECK-SAME: () #[[ATTR0]] { | ||
; CHECK-NEXT: [[TMP:%.*]] = call i32 @a() | ||
; CHECK-NEXT: ret i32 [[TMP]] | ||
; | ||
%tmp = call i32 @a() | ||
ret i32 %tmp | ||
} |
40 changes: 21 additions & 19 deletions
40
llvm/test/Transforms/FunctionAttrs/2008-09-03-ReadNone.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,34 @@ | ||
; RUN: opt < %s -function-attrs -S | FileCheck %s | ||
; RUN: opt < %s -aa-pipeline=basic-aa -passes=function-attrs -S | FileCheck %s | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-attributes | ||
; RUN: opt < %s -passes=function-attrs -S | FileCheck %s | ||
|
||
@x = global i32 0 | ||
|
||
; CHECK: Function Attrs | ||
; CHECK-SAME: readnone | ||
; CHECK-NEXT: declare i32 @e | ||
declare i32 @e() readnone | ||
|
||
; CHECK: Function Attrs | ||
; CHECK-SAME: readnone | ||
; CHECK-NEXT: define i32 @f | ||
define i32 @f() { | ||
%tmp = call i32 @e( ) ; <i32> [#uses=1] | ||
ret i32 %tmp | ||
; CHECK: Function Attrs: nofree nosync readnone | ||
; CHECK-LABEL: @f( | ||
; CHECK-NEXT: [[TMP:%.*]] = call i32 @e() | ||
; CHECK-NEXT: ret i32 [[TMP]] | ||
; | ||
%tmp = call i32 @e() | ||
ret i32 %tmp | ||
} | ||
|
||
; CHECK: Function Attrs | ||
; CHECK-SAME: readnone | ||
; CHECK-NEXT: define i32 @g | ||
define i32 @g() readonly { | ||
ret i32 0 | ||
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn | ||
; CHECK-LABEL: @g( | ||
; CHECK-NEXT: ret i32 0 | ||
; | ||
ret i32 0 | ||
} | ||
|
||
; CHECK: Function Attrs | ||
; CHECK-SAME: readnone | ||
; CHECK-NEXT: define i32 @h | ||
define i32 @h() readnone { | ||
%tmp = load i32, i32* @x ; <i32> [#uses=1] | ||
ret i32 %tmp | ||
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn | ||
; CHECK-LABEL: @h( | ||
; CHECK-NEXT: [[TMP:%.*]] = load i32, i32* @x, align 4 | ||
; CHECK-NEXT: ret i32 [[TMP]] | ||
; | ||
%tmp = load i32, i32* @x | ||
ret i32 %tmp | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
; RUN: opt < %s -aa-pipeline=basic-aa -passes=function-attrs -S | FileCheck %s | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-attributes | ||
; RUN: opt < %s -passes=function-attrs -S | FileCheck %s | ||
|
||
; CHECK: define i32 @f() #0 | ||
define i32 @f() { | ||
; CHECK: Function Attrs: nofree readonly | ||
; CHECK-LABEL: @f( | ||
; CHECK-NEXT: entry: | ||
; CHECK-NEXT: [[TMP:%.*]] = call i32 @e() | ||
; CHECK-NEXT: ret i32 [[TMP]] | ||
; | ||
entry: | ||
%tmp = call i32 @e( ) | ||
ret i32 %tmp | ||
} | ||
|
||
; CHECK: declare i32 @e() #1 | ||
declare i32 @e() readonly | ||
|
||
; CHECK: attributes #0 = { nofree readonly } | ||
; CHECK: attributes #1 = { readonly } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
; RUN: opt < %s -function-attrs -S | FileCheck %s | ||
; RUN: opt < %s -aa-pipeline=basic-aa -passes=function-attrs -S | FileCheck %s | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-attributes | ||
; RUN: opt < %s -passes=function-attrs -S | FileCheck %s | ||
|
||
@s = external constant i8 ; <i8*> [#uses=1] | ||
@s = external constant i8 | ||
|
||
; CHECK: define i8 @f() #0 | ||
define i8 @f() { | ||
%tmp = load i8, i8* @s ; <i8> [#uses=1] | ||
ret i8 %tmp | ||
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn | ||
; CHECK-LABEL: @f( | ||
; CHECK-NEXT: [[TMP:%.*]] = load i8, i8* @s, align 1 | ||
; CHECK-NEXT: ret i8 [[TMP]] | ||
; | ||
%tmp = load i8, i8* @s | ||
ret i8 %tmp | ||
} | ||
|
||
; CHECK: attributes #0 = { {{.*}} readnone |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,32 @@ | ||
; RUN: opt -S < %s -function-attrs | FileCheck %s | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-attributes | ||
; RUN: opt -S < %s -passes=function-attrs | FileCheck %s | ||
|
||
; CHECK: Function Attrs | ||
; CHECK-SAME: inaccessiblememonly | ||
; CHECK-NEXT: declare void @llvm.sideeffect() | ||
declare void @llvm.sideeffect() | ||
|
||
; Don't add readnone or similar attributes when an @llvm.sideeffect() intrinsic | ||
; is present. | ||
|
||
; CHECK: Function Attrs | ||
; CHECK-NOT: readnone | ||
; CHECK: define void @test() | ||
define void @test() { | ||
call void @llvm.sideeffect() | ||
ret void | ||
; CHECK: Function Attrs: inaccessiblememonly mustprogress nofree nosync nounwind willreturn | ||
; CHECK-LABEL: @test( | ||
; CHECK-NEXT: call void @llvm.sideeffect() | ||
; CHECK-NEXT: ret void | ||
; | ||
call void @llvm.sideeffect() | ||
ret void | ||
} | ||
|
||
; CHECK: Function Attrs | ||
; CHECK-NOT: readnone | ||
; CHECK: define void @loop() | ||
define void @loop() { | ||
br label %loop | ||
; CHECK: Function Attrs: inaccessiblememonly nofree noreturn nosync nounwind | ||
; CHECK-LABEL: @loop( | ||
; CHECK-NEXT: br label [[LOOP:%.*]] | ||
; CHECK: loop: | ||
; CHECK-NEXT: call void @llvm.sideeffect() | ||
; CHECK-NEXT: br label [[LOOP]] | ||
; | ||
br label %loop | ||
|
||
loop: | ||
call void @llvm.sideeffect() | ||
br label %loop | ||
call void @llvm.sideeffect() | ||
br label %loop | ||
} |
Oops, something went wrong.