Skip to content

Commit bc96516

Browse files
committed
Mark pure asm as willreturn
1 parent 41b8158 commit bc96516

File tree

4 files changed

+5
-0
lines changed

4 files changed

+5
-0
lines changed

compiler/rustc_codegen_llvm/src/asm.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ impl AsmBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> {
304304
} else if options.contains(InlineAsmOptions::READONLY) {
305305
llvm::Attribute::ReadOnly.apply_callsite(llvm::AttributePlace::Function, result);
306306
}
307+
llvm::Attribute::WillReturn.apply_callsite(llvm::AttributePlace::Function, result);
307308
} else if options.contains(InlineAsmOptions::NOMEM) {
308309
llvm::Attribute::InaccessibleMemOnly
309310
.apply_callsite(llvm::AttributePlace::Function, result);

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ pub enum Attribute {
132132
ReadNone = 26,
133133
InaccessibleMemOnly = 27,
134134
SanitizeHWAddress = 28,
135+
WillReturn = 29,
135136
}
136137

137138
/// LLVMIntPredicate

compiler/rustc_llvm/llvm-wrapper/LLVMWrapper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ enum LLVMRustAttribute {
8686
ReadNone = 26,
8787
InaccessibleMemOnly = 27,
8888
SanitizeHWAddress = 28,
89+
WillReturn = 29,
8990
};
9091

9192
typedef struct OpaqueRustString *RustStringRef;

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,8 @@ static Attribute::AttrKind fromRust(LLVMRustAttribute Kind) {
207207
return Attribute::InaccessibleMemOnly;
208208
case SanitizeHWAddress:
209209
return Attribute::SanitizeHWAddress;
210+
case WillReturn:
211+
return Attribute::WillReturn;
210212
}
211213
report_fatal_error("bad AttributeKind");
212214
}

0 commit comments

Comments
 (0)