@@ -9,9 +9,9 @@ use rspirv::spirv::GLOp;
9
9
use rustc_codegen_ssa:: mir:: operand:: OperandRef ;
10
10
use rustc_codegen_ssa:: mir:: place:: PlaceRef ;
11
11
use rustc_codegen_ssa:: traits:: { BuilderMethods , IntrinsicCallMethods } ;
12
- use rustc_middle:: bug;
13
12
use rustc_middle:: ty:: layout:: LayoutOf ;
14
13
use rustc_middle:: ty:: { FnDef , Instance , ParamEnv , Ty , TyKind } ;
14
+ use rustc_middle:: { bug, ty} ;
15
15
use rustc_span:: sym;
16
16
use rustc_span:: Span ;
17
17
use rustc_target:: abi:: call:: { FnAbi , PassMode } ;
@@ -71,7 +71,7 @@ impl<'a, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'tcx> {
71
71
args : & [ OperandRef < ' tcx , Self :: Value > ] ,
72
72
llresult : Self :: Value ,
73
73
_span : Span ,
74
- ) {
74
+ ) -> Result < ( ) , ty :: Instance < ' tcx > > {
75
75
let callee_ty = instance. ty ( self . tcx , ParamEnv :: reveal_all ( ) ) ;
76
76
77
77
let ( def_id, fn_args) = match * callee_ty. kind ( ) {
@@ -98,7 +98,7 @@ impl<'a, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'tcx> {
98
98
sym:: breakpoint => {
99
99
self . abort ( ) ;
100
100
assert ! ( fn_abi. ret. is_ignore( ) ) ;
101
- return ;
101
+ return Ok ( ( ) ) ;
102
102
}
103
103
104
104
sym:: volatile_load | sym:: unaligned_volatile_load => {
@@ -108,7 +108,7 @@ impl<'a, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'tcx> {
108
108
if !result. layout . is_zst ( ) {
109
109
self . store ( load, result. llval , result. align ) ;
110
110
}
111
- return ;
111
+ return Ok ( ( ) ) ;
112
112
}
113
113
114
114
sym:: prefetch_read_data
@@ -117,7 +117,7 @@ impl<'a, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'tcx> {
117
117
| sym:: prefetch_write_instruction => {
118
118
// ignore
119
119
assert ! ( fn_abi. ret. is_ignore( ) ) ;
120
- return ;
120
+ return Ok ( ( ) ) ;
121
121
}
122
122
123
123
sym:: saturating_add => {
@@ -336,7 +336,10 @@ impl<'a, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'tcx> {
336
336
undef
337
337
}
338
338
339
- _ => self . fatal ( format ! ( "TODO: Unknown intrinsic '{name}'" ) ) ,
339
+ _ => {
340
+ // Call the fallback body instead of generating the intrinsic code
341
+ return Err ( ty:: Instance :: new ( instance. def_id ( ) , instance. args ) ) ;
342
+ }
340
343
} ;
341
344
342
345
if !fn_abi. ret . is_ignore ( ) {
@@ -345,6 +348,7 @@ impl<'a, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'tcx> {
345
348
. val
346
349
. store ( self , result) ;
347
350
}
351
+ Ok ( ( ) )
348
352
}
349
353
350
354
fn abort ( & mut self ) {
0 commit comments