Enzyme
Enzyme copied to clipboard
Illegal TA update
https://fwd.gymni.ch/zyzfSQ
https://fwd.gymni.ch/NksYXn
https://fwd.gymni.ch/mfUfQe
https://fwd.gymni.ch/zny4iZ
; ModuleID = 'ta7.ll'
source_filename = "ld-temp.o"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
%copy_map = type <{ i8, i8, i64, { i8, i64, %copy_map_entry* }, i64, %ordered_index_node* }>
%copy_map_entry = type { %ordered_index_node*, %ordered_index_node* }
%ordered_index_node = type { { { { { [72 x i8] } } } }, i64 }
$foo = comdat any
; Function Attrs: uwtable
define weak_odr dso_local i1 @foo(%copy_map* noundef nonnull align 8 dereferenceable(65) %arg2) local_unnamed_addr #0 comdat align 2 {
bb:
%i35 = getelementptr inbounds %copy_map, %copy_map* %arg2, i64 0, i32 5
%i41 = getelementptr inbounds %copy_map, %copy_map* %arg2, i64 0, i32 3, i32 2
%0 = bitcast %copy_map_entry** %i41 to %ordered_index_node***
%i1601 = load %ordered_index_node**, %ordered_index_node*** %0, align 8, !tbaa !8
%i169 = load %ordered_index_node*, %ordered_index_node** %i1601, align 8, !tbaa !15
%i173 = getelementptr inbounds %ordered_index_node, %ordered_index_node* %i169, i64 0, i32 0, i32 0, i32 0, i32 0, i32 0, i64 72
%i174 = bitcast i8* %i173 to i64*
%i182 = load i64, i64* %i174, align 8, !tbaa !17
%i183 = and i64 %i182, -2
%i184 = inttoptr i64 %i183 to { i64 }*
%i188 = getelementptr inbounds { i64 }, { i64 }* %i184, i64 -3
%i189 = bitcast { i64 }* %i188 to %ordered_index_node*
%i190 = load %ordered_index_node*, %ordered_index_node** %i35, align 8, !tbaa !18
%i191 = icmp eq %ordered_index_node* %i190, %i189
ret i1 %i191
}
attributes #0 = { uwtable "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
!llvm.ident = !{!0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0}
!llvm.module.flags = !{!1, !2, !3, !4, !5, !6, !7}
!0 = !{!"clang version 14.0.6 ([email protected]:llvm/llvm-project.git f28c006a5895fc0e329fe15fead81e37457cb1d1)"}
!1 = !{i32 1, !"wchar_size", i32 4}
!2 = !{i32 7, !"PIC Level", i32 2}
!3 = !{i32 7, !"PIE Level", i32 2}
!4 = !{i32 7, !"uwtable", i32 1}
!5 = !{i32 1, !"ThinLTO", i32 0}
!6 = !{i32 1, !"EnableSplitLTOUnit", i32 1}
!7 = !{i32 1, !"LTOPostLink", i32 1}
!8 = !{!9, !14, i64 16}
!9 = !{!"_ZTSN5boost11multi_index6detail10auto_spaceINS1_14copy_map_entryINS1_20ordered_index_nodeINS1_18ordered_index_nodeINS1_19null_augment_policyENS1_15index_node_baseISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_13property_tree11basic_ptreeISE_SE_St4lessISE_EEEESaISL_EEEEEEEEESM_EE", !10, i64 0, !11, i64 8, !14, i64 16}
!10 = !{!"_ZTSSaIN5boost11multi_index6detail14copy_map_entryINS1_20ordered_index_nodeINS1_18ordered_index_nodeINS1_19null_augment_policyENS1_15index_node_baseISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_13property_tree11basic_ptreeISD_SD_St4lessISD_EEEESaISK_EEEEEEEEEE"}
!11 = !{!"long", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C++ TBAA"}
!14 = !{!"any pointer", !12, i64 0}
!15 = !{!16, !14, i64 0}
!16 = !{!"_ZTSN5boost11multi_index6detail14copy_map_entryINS1_20ordered_index_nodeINS1_18ordered_index_nodeINS1_19null_augment_policyENS1_15index_node_baseISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_13property_tree11basic_ptreeISD_SD_St4lessISD_EEEESaISK_EEEEEEEEE", !14, i64 0, !14, i64 8}
!17 = !{!11, !11, i64 0}
!18 = !{!19, !14, i64 48}
!19 = !{!"_ZTSN5boost11multi_index6detail8copy_mapINS1_20ordered_index_nodeINS1_18ordered_index_nodeINS1_19null_augment_policyENS1_15index_node_baseISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_13property_tree11basic_ptreeISD_SD_St4lessISD_EEEESaISK_EEEEEEESL_EE", !20, i64 0, !11, i64 8, !9, i64 16, !11, i64 40, !14, i64 48, !14, i64 56, !21, i64 64}
!20 = !{!"_ZTSSaIN5boost11multi_index6detail20ordered_index_nodeINS1_18ordered_index_nodeINS1_19null_augment_policyENS1_15index_node_baseISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_13property_tree11basic_ptreeISC_SC_St4lessISC_EEEESaISJ_EEEEEEEE"}
!21 = !{!"bool", !12, i64 0}
@wsmoses
The main issue I minimized for is
Illegal updateAnalysis prev:{[-1]:Pointer} new: {[-1]:Integer}
However, I also got a
could not perform minus one for gep'd: %i188 = getelementptr inbounds %"struct.boost::multi_index::detail::ordered_index_node_impl", %"struct.boost::multi_index::detail::ordered_index_node_impl"* %i184, i64 -3
How relevant is the gep failure? I got a few more on my latest project, some of which of I got rid during minimizing this bug.
https://fwd.gymni.ch/SEW444
https://fwd.gymni.ch/MxFncS
related https://github.com/EnzymeAD/Enzyme/issues/1029
Minimized a bit further: https://fwd.gymni.ch/Cf3bvU https://fwd.gymni.ch/sGgTaM
%i182 = load i64, i64* %i174, align 8, !tbaa !17
%i183 = and i64 %i182, -2
%i184 = inttoptr i64 %i183 to { i64 }*
what part of the source code creates this.
Specifically this is a c long being reinterpreted into a pointer, which is causing the issue.