@@ -9,10 +9,16 @@ declare ptr @llvm.call.preallocated.arg(token, i32)
9
9
10
10
@str = private unnamed_addr addrspace (4 ) constant [1 x i8 ] c "\00 " , align 1
11
11
@ConstAS3Ptr = addrspace (3 ) global i32 0 , align 4
12
+ @ConstPtr = constant i32 0 , align 4
13
+ @ConstWeakPtr = weak constant i32 0 , align 4
14
+ @ConstWeakODRPtr = weak_odr constant i32 0 , align 4
12
15
13
16
;.
14
17
; CHECK: @[[STR:[a-zA-Z0-9_$"\\.-]+]] = private unnamed_addr addrspace(4) constant [1 x i8] zeroinitializer, align 1
15
18
; CHECK: @[[CONSTAS3PTR:[a-zA-Z0-9_$"\\.-]+]] = addrspace(3) global i32 0, align 4
19
+ ; CHECK: @[[CONSTPTR:[a-zA-Z0-9_$"\\.-]+]] = constant i32 0, align 4
20
+ ; CHECK: @[[CONSTWEAKPTR:[a-zA-Z0-9_$"\\.-]+]] = weak constant i32 0, align 4
21
+ ; CHECK: @[[CONSTWEAKODRPTR:[a-zA-Z0-9_$"\\.-]+]] = weak_odr constant i32 0, align 4
16
22
; CHECK: @[[S:[a-zA-Z0-9_$"\\.-]+]] = external global [[STRUCT_X:%.*]]
17
23
; CHECK: @[[G:[a-zA-Z0-9_$"\\.-]+]] = internal constant { [2 x ptr] } { [2 x ptr] [ptr @f1, ptr @f2] }
18
24
; CHECK: @[[X:[a-zA-Z0-9_$"\\.-]+]] = external global i32
@@ -1632,6 +1638,53 @@ dead5:
1632
1638
ret i8 5
1633
1639
}
1634
1640
1641
+ define i32 @readConst () {
1642
+ ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
1643
+ ; TUNIT-LABEL: define {{[^@]+}}@readConst
1644
+ ; TUNIT-SAME: () #[[ATTR2]] {
1645
+ ; TUNIT-NEXT: ret i32 0
1646
+ ;
1647
+ ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
1648
+ ; CGSCC-LABEL: define {{[^@]+}}@readConst
1649
+ ; CGSCC-SAME: () #[[ATTR1]] {
1650
+ ; CGSCC-NEXT: ret i32 0
1651
+ ;
1652
+ %l = load i32 , ptr @ConstPtr
1653
+ ret i32 %l
1654
+ }
1655
+
1656
+ define i32 @readWeakConst () {
1657
+ ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
1658
+ ; TUNIT-LABEL: define {{[^@]+}}@readWeakConst
1659
+ ; TUNIT-SAME: () #[[ATTR2]] {
1660
+ ; TUNIT-NEXT: [[L:%.*]] = load i32, ptr @ConstWeakPtr, align 4
1661
+ ; TUNIT-NEXT: ret i32 [[L]]
1662
+ ;
1663
+ ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
1664
+ ; CGSCC-LABEL: define {{[^@]+}}@readWeakConst
1665
+ ; CGSCC-SAME: () #[[ATTR1]] {
1666
+ ; CGSCC-NEXT: [[L:%.*]] = load i32, ptr @ConstWeakPtr, align 4
1667
+ ; CGSCC-NEXT: ret i32 [[L]]
1668
+ ;
1669
+ %l = load i32 , ptr @ConstWeakPtr
1670
+ ret i32 %l
1671
+ }
1672
+
1673
+ define i32 @readWeakOdrConst () {
1674
+ ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
1675
+ ; TUNIT-LABEL: define {{[^@]+}}@readWeakOdrConst
1676
+ ; TUNIT-SAME: () #[[ATTR2]] {
1677
+ ; TUNIT-NEXT: ret i32 0
1678
+ ;
1679
+ ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
1680
+ ; CGSCC-LABEL: define {{[^@]+}}@readWeakOdrConst
1681
+ ; CGSCC-SAME: () #[[ATTR1]] {
1682
+ ; CGSCC-NEXT: ret i32 0
1683
+ ;
1684
+ %l = load i32 , ptr @ConstWeakODRPtr
1685
+ ret i32 %l
1686
+ }
1687
+
1635
1688
;.
1636
1689
; TUNIT: attributes #[[ATTR0:[0-9]+]] = { nocallback nofree nosync nounwind willreturn }
1637
1690
; TUNIT: attributes #[[ATTR1]] = { memory(readwrite, argmem: none) }
0 commit comments