@@ -25,7 +25,7 @@ use crate::abi::FnAbiLlvmExt;
2525use crate :: builder:: Builder ;
2626use crate :: builder:: autodiff:: { adjust_activity_to_abi, generate_enzyme_call} ;
2727use crate :: context:: CodegenCx ;
28- use crate :: errors:: AutoDiffWithoutEnable ;
28+ use crate :: errors:: { AutoDiffWithoutEnable , AutoDiffWithoutLto } ;
2929use crate :: llvm:: { self , Metadata , Type , Value } ;
3030use crate :: type_of:: LayoutLlvmExt ;
3131use crate :: va_arg:: emit_va_arg;
@@ -378,8 +378,6 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
378378 | sym:: ctpop
379379 | sym:: bswap
380380 | sym:: bitreverse
381- | sym:: rotate_left
382- | sym:: rotate_right
383381 | sym:: saturating_add
384382 | sym:: saturating_sub
385383 | sym:: unchecked_funnel_shl
@@ -424,19 +422,11 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
424422 sym:: bitreverse => {
425423 self . call_intrinsic ( "llvm.bitreverse" , & [ llty] , & [ args[ 0 ] . immediate ( ) ] )
426424 }
427- sym:: rotate_left
428- | sym:: rotate_right
429- | sym:: unchecked_funnel_shl
430- | sym:: unchecked_funnel_shr => {
431- let is_left = name == sym:: rotate_left || name == sym:: unchecked_funnel_shl;
425+ sym:: unchecked_funnel_shl | sym:: unchecked_funnel_shr => {
426+ let is_left = name == sym:: unchecked_funnel_shl;
432427 let lhs = args[ 0 ] . immediate ( ) ;
433- let ( rhs, raw_shift) =
434- if name == sym:: rotate_left || name == sym:: rotate_right {
435- // rotate = funnel shift with first two args the same
436- ( lhs, args[ 1 ] . immediate ( ) )
437- } else {
438- ( args[ 1 ] . immediate ( ) , args[ 2 ] . immediate ( ) )
439- } ;
428+ let rhs = args[ 1 ] . immediate ( ) ;
429+ let raw_shift = args[ 2 ] . immediate ( ) ;
440430 let llvm_name = format ! ( "llvm.fsh{}" , if is_left { 'l' } else { 'r' } ) ;
441431
442432 // llvm expects shift to be the same type as the values, but rust
@@ -1146,6 +1136,9 @@ fn codegen_autodiff<'ll, 'tcx>(
11461136 if !tcx. sess . opts . unstable_opts . autodiff . contains ( & rustc_session:: config:: AutoDiff :: Enable ) {
11471137 let _ = tcx. dcx ( ) . emit_almost_fatal ( AutoDiffWithoutEnable ) ;
11481138 }
1139+ if tcx. sess . lto ( ) != rustc_session:: config:: Lto :: Fat {
1140+ let _ = tcx. dcx ( ) . emit_almost_fatal ( AutoDiffWithoutLto ) ;
1141+ }
11491142
11501143 let fn_args = instance. args ;
11511144 let callee_ty = instance. ty ( tcx, bx. typing_env ( ) ) ;
0 commit comments