; LLVM IR from facebook/redex :: service/constant-propagation (ConstantPropagationAnalysis)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%class.DisjointUnionWithSignedConstantDomain = type { %"class.boost::variant.75" }
%"class.boost::variant.75" = type { i32, [4 x i8], %"class.boost::aligned_storage.76" }
%"class.boost::aligned_storage.76" = type { %"struct.boost::detail::aligned_storage::aligned_storage_imp.77" }
%"struct.boost::detail::aligned_storage::aligned_storage_imp.77" = type { %"union.boost::detail::aligned_storage::aligned_storage_imp<40, 8>::data_t" }
%"union.boost::detail::aligned_storage::aligned_storage_imp<40, 8>::data_t" = type { [40 x i8] }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare noundef i32 @_ZNK13IRInstruction3srcEt(ptr noundef nonnull align 8 dereferenceable(32), i16 noundef zeroext) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK19ConstantEnvironment3getEj(ptr dead_on_unwind noalias writable sret(%class.DisjointUnionWithSignedConstantDomain) align 8, ptr noundef nonnull align 8 dereferenceable(48), i32 noundef) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN37DisjointUnionWithSignedConstantDomainI17is_object_visitorJN6sparta22ConstantAbstractDomainIPK8DexFieldEENS1_17SetAbstractDomainINS1_7HashSetIlSt4hashIlESt8equal_toIlEEEEENS7_INS1_15PatriciaTreeSetIPK9DexStringEEEENS2_ISI_EENS2_IPK7DexTypeEENS2_IiEE25ObjectWithImmutAttrDomain15NewObjectDomainNS2_IPK13IRInstructionEEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_Z13resolve_fieldPK11DexFieldRef11FieldSearch(ptr noundef, i32 noundef) #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK13IRInstruction9get_fieldEv(ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK11DexFieldRef9get_classEv(ptr noundef nonnull align 8 dereferenceable(26)) #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN20constant_propagation19ClinitFieldAnalyzer12analyze_sputEPK7DexTypePK13IRInstructionP19ConstantEnvironment(ptr noundef %0, ptr noundef %1, ptr noundef %2) #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca %class.DisjointUnionWithSignedConstantDomain, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = call noundef ptr @_ZNK13IRInstruction9get_fieldEv(ptr noundef nonnull align 8 dereferenceable(32) %13)
  %15 = call noundef ptr @_Z13resolve_fieldPK11DexFieldRef11FieldSearch(ptr noundef %14, i32 noundef 2)
  store ptr %15, ptr %8, align 8, !tbaa !5
  %16 = load ptr, ptr %8, align 8, !tbaa !5
  %17 = icmp eq ptr %16, null
  br i1 %17, label %18, label %19

18:                                               ; preds = %3
  store i1 false, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %37

19:                                               ; preds = %3
  %20 = load ptr, ptr %8, align 8, !tbaa !5
  %21 = call noundef ptr @_ZNK11DexFieldRef9get_classEv(ptr noundef nonnull align 8 dereferenceable(26) %20)
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = icmp eq ptr %21, %22
  br i1 %23, label %24, label %36

24:                                               ; preds = %19
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 48, ptr %10) #6
  %27 = load ptr, ptr %7, align 8, !tbaa !5
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = call noundef i32 @_ZNK13IRInstruction3srcEt(ptr noundef nonnull align 8 dereferenceable(32) %28, i16 noundef zeroext 0)
  call void @_ZNK19ConstantEnvironment3getEj(ptr dead_on_unwind writable sret(%class.DisjointUnionWithSignedConstantDomain) align 8 %10, ptr noundef nonnull align 8 dereferenceable(48) %27, i32 noundef %29)
  %30 = invoke noundef nonnull align 8 dereferenceable(48) ptr @_ZN19ConstantEnvironment3setEPK8DexFieldRK37DisjointUnionWithSignedConstantDomainI17is_object_visitorJN6sparta22ConstantAbstractDomainIS2_EENS5_17SetAbstractDomainINS5_7HashSetIlSt4hashIlESt8equal_toIlEEEEENS8_INS5_15PatriciaTreeSetIPK9DexStringEEEENS6_ISJ_EENS6_IPK7DexTypeEENS6_IiEE25ObjectWithImmutAttrDomain15NewObjectDomainNS6_IPK13IRInstructionEEEE(ptr noundef nonnull align 8 dereferenceable(48) %25, ptr noundef %26, ptr noundef nonnull align 8 dereferenceable(48) %10)
          to label %31 unwind label %32

31:                                               ; preds = %24
  call void @_ZN37DisjointUnionWithSignedConstantDomainI17is_object_visitorJN6sparta22ConstantAbstractDomainIPK8DexFieldEENS1_17SetAbstractDomainINS1_7HashSetIlSt4hashIlESt8equal_toIlEEEEENS7_INS1_15PatriciaTreeSetIPK9DexStringEEEENS2_ISI_EENS2_IPK7DexTypeEENS2_IiEE25ObjectWithImmutAttrDomain15NewObjectDomainNS2_IPK13IRInstructionEEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %10) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %10) #6
  store i1 true, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %37

32:                                               ; preds = %24
  %33 = landingpad { ptr, i32 }
          cleanup
  %34 = extractvalue { ptr, i32 } %33, 0
  store ptr %34, ptr %11, align 8
  %35 = extractvalue { ptr, i32 } %33, 1
  store i32 %35, ptr %12, align 4
  call void @_ZN37DisjointUnionWithSignedConstantDomainI17is_object_visitorJN6sparta22ConstantAbstractDomainIPK8DexFieldEENS1_17SetAbstractDomainINS1_7HashSetIlSt4hashIlESt8equal_toIlEEEEENS7_INS1_15PatriciaTreeSetIPK9DexStringEEEENS2_ISI_EENS2_IPK7DexTypeEENS2_IiEE25ObjectWithImmutAttrDomain15NewObjectDomainNS2_IPK13IRInstructionEEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %10) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %39

36:                                               ; preds = %19
  store i1 false, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %37

37:                                               ; preds = %36, %31, %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  %38 = load i1, ptr %4, align 1
  ret i1 %38

39:                                               ; preds = %32
  %40 = load ptr, ptr %11, align 8
  %41 = load i32, ptr %12, align 4
  %42 = insertvalue { ptr, i32 } poison, ptr %40, 0
  %43 = insertvalue { ptr, i32 } %42, i32 %41, 1
  resume { ptr, i32 } %43
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(48) ptr @_ZN19ConstantEnvironment3setEPK8DexFieldRK37DisjointUnionWithSignedConstantDomainI17is_object_visitorJN6sparta22ConstantAbstractDomainIS2_EENS5_17SetAbstractDomainINS5_7HashSetIlSt4hashIlESt8equal_toIlEEEEENS8_INS5_15PatriciaTreeSetIPK9DexStringEEEENS6_ISJ_EENS6_IPK7DexTypeEENS6_IiEE25ObjectWithImmutAttrDomain15NewObjectDomainNS6_IPK13IRInstructionEEEE(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef, ptr noundef nonnull align 8 dereferenceable(48)) #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%class.DisjointUnionWithSignedConstantDomain = type { %"class.boost::variant.75" }
%"class.boost::variant.75" = type { i32, [4 x i8], %"class.boost::aligned_storage.76" }
%"class.boost::aligned_storage.76" = type { %"struct.boost::detail::aligned_storage::aligned_storage_imp.77" }
%"struct.boost::detail::aligned_storage::aligned_storage_imp.77" = type { %"union.boost::detail::aligned_storage::aligned_storage_imp<40, 8>::data_t" }
%"union.boost::detail::aligned_storage::aligned_storage_imp<40, 8>::data_t" = type { [40 x i8] }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare noundef i32 @_ZNK13IRInstruction3srcEt(ptr noundef nonnull align 8 dereferenceable(32), i16 noundef zeroext) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK19ConstantEnvironment3getEj(ptr dead_on_unwind noalias writable sret(%class.DisjointUnionWithSignedConstantDomain) align 8, ptr noundef nonnull align 8 dereferenceable(48), i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN37DisjointUnionWithSignedConstantDomainI17is_object_visitorJN6sparta22ConstantAbstractDomainIPK8DexFieldEENS1_17SetAbstractDomainINS1_7HashSetIlSt4hashIlESt8equal_toIlEEEEENS7_INS1_15PatriciaTreeSetIPK9DexStringEEEENS2_ISI_EENS2_IPK7DexTypeEENS2_IiEE25ObjectWithImmutAttrDomain15NewObjectDomainNS2_IPK13IRInstructionEEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_Z13resolve_fieldPK11DexFieldRef11FieldSearch(ptr noundef, i32 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK13IRInstruction9get_fieldEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK11DexFieldRef9get_classEv(ptr noundef nonnull align 8 dereferenceable(26)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN20constant_propagation19ClinitFieldAnalyzer12analyze_sputEPK7DexTypePK13IRInstructionP19ConstantEnvironment(ptr noundef readnone %0, ptr noundef nonnull %1, ptr noundef %2) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %class.DisjointUnionWithSignedConstantDomain, align 8
  %5 = tail call noundef ptr @_ZNK13IRInstruction9get_fieldEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %6 = tail call noundef ptr @_Z13resolve_fieldPK11DexFieldRef11FieldSearch(ptr noundef %5, i32 noundef 2)
  %7 = icmp eq ptr %6, null
  br i1 %7, label %17, label %8

8:                                                ; preds = %3
  %9 = tail call noundef ptr @_ZNK11DexFieldRef9get_classEv(ptr noundef nonnull align 8 dereferenceable(26) %6)
  %10 = icmp eq ptr %9, %0
  br i1 %10, label %11, label %17

11:                                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %4) #6
  %12 = tail call noundef i32 @_ZNK13IRInstruction3srcEt(ptr noundef nonnull align 8 dereferenceable(32) %1, i16 noundef zeroext 0)
  call void @_ZNK19ConstantEnvironment3getEj(ptr dead_on_unwind nonnull writable sret(%class.DisjointUnionWithSignedConstantDomain) align 8 %4, ptr noundef nonnull align 8 dereferenceable(48) %2, i32 noundef %12)
  %13 = invoke noundef nonnull align 8 dereferenceable(48) ptr @_ZN19ConstantEnvironment3setEPK8DexFieldRK37DisjointUnionWithSignedConstantDomainI17is_object_visitorJN6sparta22ConstantAbstractDomainIS2_EENS5_17SetAbstractDomainINS5_7HashSetIlSt4hashIlESt8equal_toIlEEEEENS8_INS5_15PatriciaTreeSetIPK9DexStringEEEENS6_ISJ_EENS6_IPK7DexTypeEENS6_IiEE25ObjectWithImmutAttrDomain15NewObjectDomainNS6_IPK13IRInstructionEEEE(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull %6, ptr noundef nonnull align 8 dereferenceable(48) %4)
          to label %14 unwind label %15

14:                                               ; preds = %11
  call void @_ZN37DisjointUnionWithSignedConstantDomainI17is_object_visitorJN6sparta22ConstantAbstractDomainIPK8DexFieldEENS1_17SetAbstractDomainINS1_7HashSetIlSt4hashIlESt8equal_toIlEEEEENS7_INS1_15PatriciaTreeSetIPK9DexStringEEEENS2_ISI_EENS2_IPK7DexTypeEENS2_IiEE25ObjectWithImmutAttrDomain15NewObjectDomainNS2_IPK13IRInstructionEEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %4) #6
  br label %17

15:                                               ; preds = %11
  %16 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN37DisjointUnionWithSignedConstantDomainI17is_object_visitorJN6sparta22ConstantAbstractDomainIPK8DexFieldEENS1_17SetAbstractDomainINS1_7HashSetIlSt4hashIlESt8equal_toIlEEEEENS7_INS1_15PatriciaTreeSetIPK9DexStringEEEENS2_ISI_EENS2_IPK7DexTypeEENS2_IiEE25ObjectWithImmutAttrDomain15NewObjectDomainNS2_IPK13IRInstructionEEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %4) #6
  resume { ptr, i32 } %16

17:                                               ; preds = %8, %3, %14
  %.0 = phi i1 [ true, %14 ], [ false, %3 ], [ false, %8 ]
  ret i1 %.0
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(48) ptr @_ZN19ConstantEnvironment3setEPK8DexFieldRK37DisjointUnionWithSignedConstantDomainI17is_object_visitorJN6sparta22ConstantAbstractDomainIS2_EENS5_17SetAbstractDomainINS5_7HashSetIlSt4hashIlESt8equal_toIlEEEEENS8_INS5_15PatriciaTreeSetIPK9DexStringEEEENS6_ISJ_EENS6_IPK7DexTypeEENS6_IiEE25ObjectWithImmutAttrDomain15NewObjectDomainNS6_IPK13IRInstructionEEEE(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef, ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #2 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass