@@ -14,7 +14,6 @@ use rustc_middle::bug;
14
14
use rustc_middle:: ty:: layout:: LayoutOf ;
15
15
pub use rustc_middle:: ty:: layout:: { FAT_PTR_ADDR , FAT_PTR_EXTRA } ;
16
16
use rustc_middle:: ty:: Ty ;
17
- use rustc_session:: config;
18
17
use rustc_target:: abi:: call:: ArgAbi ;
19
18
pub use rustc_target:: abi:: call:: * ;
20
19
use rustc_target:: abi:: { self , HasDataLayout , Int } ;
@@ -71,26 +70,23 @@ fn get_attrs<'ll>(this: &ArgAttributes, cx: &CodegenCx<'ll, '_>) -> SmallVec<[&'
71
70
ArgExtension :: Sext => attrs. push ( llvm:: AttributeKind :: SExt . create_attr ( cx. llcx ) ) ,
72
71
}
73
72
74
- // Only apply remaining attributes when optimizing
75
- if cx. sess ( ) . opts . optimize != config:: OptLevel :: No {
76
- let deref = this. pointee_size . bytes ( ) ;
77
- if deref != 0 {
78
- if regular. contains ( ArgAttribute :: NonNull ) {
79
- attrs. push ( llvm:: CreateDereferenceableAttr ( cx. llcx , deref) ) ;
80
- } else {
81
- attrs. push ( llvm:: CreateDereferenceableOrNullAttr ( cx. llcx , deref) ) ;
82
- }
83
- regular -= ArgAttribute :: NonNull ;
84
- }
85
- for ( attr, llattr) in OPTIMIZATION_ATTRIBUTES {
86
- if regular. contains ( attr) {
87
- attrs. push ( llattr. create_attr ( cx. llcx ) ) ;
88
- }
73
+ let deref = this. pointee_size . bytes ( ) ;
74
+ if deref != 0 {
75
+ if regular. contains ( ArgAttribute :: NonNull ) {
76
+ attrs. push ( llvm:: CreateDereferenceableAttr ( cx. llcx , deref) ) ;
77
+ } else {
78
+ attrs. push ( llvm:: CreateDereferenceableOrNullAttr ( cx. llcx , deref) ) ;
89
79
}
90
- if regular. contains ( ArgAttribute :: NoAliasMutRef ) && should_use_mutable_noalias ( cx) {
91
- attrs. push ( llvm:: AttributeKind :: NoAlias . create_attr ( cx. llcx ) ) ;
80
+ regular -= ArgAttribute :: NonNull ;
81
+ }
82
+ for ( attr, llattr) in OPTIMIZATION_ATTRIBUTES {
83
+ if regular. contains ( attr) {
84
+ attrs. push ( llattr. create_attr ( cx. llcx ) ) ;
92
85
}
93
86
}
87
+ if regular. contains ( ArgAttribute :: NoAliasMutRef ) && should_use_mutable_noalias ( cx) {
88
+ attrs. push ( llvm:: AttributeKind :: NoAlias . create_attr ( cx. llcx ) ) ;
89
+ }
94
90
95
91
attrs
96
92
}
0 commit comments