@@ -90,7 +90,7 @@ fn get_simple_intrinsic<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, name: Symbol) ->
90
90
}
91
91
92
92
impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
93
- fn codegen_intrinsic_call(&mut self, instance: Instance<'tcx>, fn_abi: &FnAbi<'tcx, Ty<'tcx>>, args: &[OperandRef<'tcx, RValue<'gcc>>], llresult: RValue<'gcc>, span: Span) {
93
+ fn codegen_intrinsic_call(&mut self, instance: Instance<'tcx>, fn_abi: &FnAbi<'tcx, Ty<'tcx>>, args: &[OperandRef<'tcx, RValue<'gcc>>], llresult: RValue<'gcc>, span: Span) -> Result<(), Instance<'tcx>> {
94
94
let tcx = self.tcx;
95
95
let callee_ty = instance.ty(tcx, ty::ParamEnv::reveal_all());
96
96
@@ -137,7 +137,7 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
137
137
args[2].immediate(),
138
138
llresult,
139
139
);
140
- return;
140
+ return Ok(()) ;
141
141
}
142
142
sym::breakpoint => {
143
143
unimplemented!();
@@ -166,12 +166,12 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
166
166
sym::volatile_store => {
167
167
let dst = args[0].deref(self.cx());
168
168
args[1].val.volatile_store(self, dst);
169
- return;
169
+ return Ok(()) ;
170
170
}
171
171
sym::unaligned_volatile_store => {
172
172
let dst = args[0].deref(self.cx());
173
173
args[1].val.unaligned_volatile_store(self, dst);
174
- return;
174
+ return Ok(()) ;
175
175
}
176
176
sym::prefetch_read_data
177
177
| sym::prefetch_write_data
@@ -269,7 +269,7 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
269
269
},
270
270
None => {
271
271
tcx.dcx().emit_err(InvalidMonomorphization::BasicIntegerType { span, name, ty });
272
- return;
272
+ return Ok(()) ;
273
273
}
274
274
}
275
275
}
@@ -339,7 +339,7 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
339
339
extended_asm.set_volatile_flag(true);
340
340
341
341
// We have copied the value to `result` already.
342
- return;
342
+ return Ok(()) ;
343
343
}
344
344
345
345
sym::ptr_mask => {
@@ -357,11 +357,12 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
357
357
_ if name_str.starts_with("simd_") => {
358
358
match generic_simd_intrinsic(self, name, callee_ty, args, ret_ty, llret_ty, span) {
359
359
Ok(llval) => llval,
360
- Err(()) => return,
360
+ Err(()) => return Ok(()) ,
361
361
}
362
362
}
363
363
364
- _ => bug!("unknown intrinsic '{}'", name),
364
+ // Fall back to default body
365
+ _ => return Err(Instance::new(instance.def_id(), instance.args)),
365
366
};
366
367
367
368
if !fn_abi.ret.is_ignore() {
@@ -376,6 +377,7 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
376
377
.store(self, result);
377
378
}
378
379
}
380
+ Ok(())
379
381
}
380
382
381
383
fn abort(&mut self) {
0 commit comments