; 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"

%"struct.std::pair.459" = type <{ ptr, i8, [7 x i8] }>
%class.anon.462 = type { ptr, ptr }
%"struct.constant_propagation::ImmutableAttributeAnalyzerState" = type { %class.ConcurrentMap.363, %class.ConcurrentSet.371, %class.ConcurrentSet.379, %class.UnorderedMap.387, %class.ConcurrentSet.403, %class.InsertOnlyConcurrentMap }
%class.ConcurrentMap.363 = type { %class.ConcurrentContainer.364, [83 x %"class.std::mutex"] }
%class.ConcurrentContainer.364 = type { ptr, [83 x %"class.cc_impl::ConcurrentHashtable.365"] }
%"class.cc_impl::ConcurrentHashtable.365" = type { %"struct.std::atomic.366", %"struct.std::atomic.130", %"struct.std::atomic.132", %"struct.std::atomic.368" }
%"struct.std::atomic.366" = type { %"struct.std::__atomic_base.367" }
%"struct.std::__atomic_base.367" = type { ptr }
%"struct.std::atomic.130" = type { %"struct.std::__atomic_base.131" }
%"struct.std::__atomic_base.131" = type { i64 }
%"struct.std::atomic.132" = type { %"struct.std::__atomic_base.133" }
%"struct.std::__atomic_base.133" = type { i8 }
%"struct.std::atomic.368" = type { %"struct.std::__atomic_base.369" }
%"struct.std::__atomic_base.369" = type { ptr }
%"class.std::mutex" = type { %"class.std::__mutex_base" }
%"class.std::__mutex_base" = type { %union.pthread_mutex_t }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%class.ConcurrentSet.371 = type { %class.ConcurrentContainer.372 }
%class.ConcurrentContainer.372 = type { ptr, [83 x %"class.cc_impl::ConcurrentHashtable.373"] }
%"class.cc_impl::ConcurrentHashtable.373" = type { %"struct.std::atomic.374", %"struct.std::atomic.130", %"struct.std::atomic.132", %"struct.std::atomic.376" }
%"struct.std::atomic.374" = type { %"struct.std::__atomic_base.375" }
%"struct.std::__atomic_base.375" = type { ptr }
%"struct.std::atomic.376" = type { %"struct.std::__atomic_base.377" }
%"struct.std::__atomic_base.377" = type { ptr }
%class.ConcurrentSet.379 = type { %class.ConcurrentContainer.380 }
%class.ConcurrentContainer.380 = type { ptr, [83 x %"class.cc_impl::ConcurrentHashtable.381"] }
%"class.cc_impl::ConcurrentHashtable.381" = type { %"struct.std::atomic.382", %"struct.std::atomic.130", %"struct.std::atomic.132", %"struct.std::atomic.384" }
%"struct.std::atomic.382" = type { %"struct.std::__atomic_base.383" }
%"struct.std::__atomic_base.383" = type { ptr }
%"struct.std::atomic.384" = type { %"struct.std::__atomic_base.385" }
%"struct.std::__atomic_base.385" = type { ptr }
%class.UnorderedMap.387 = type { %"class.std::unordered_map.389" }
%"class.std::unordered_map.389" = type { %"class.std::_Hashtable.390" }
%"class.std::_Hashtable.390" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.std::__detail::_Hash_node_base" = type { ptr }
%"struct.std::__detail::_Prime_rehash_policy" = type { float, i64 }
%class.ConcurrentSet.403 = type { %class.ConcurrentContainer.404 }
%class.ConcurrentContainer.404 = type { ptr, [83 x %"class.cc_impl::ConcurrentHashtable.405"] }
%"class.cc_impl::ConcurrentHashtable.405" = type { %"struct.std::atomic.406", %"struct.std::atomic.130", %"struct.std::atomic.132", %"struct.std::atomic.408" }
%"struct.std::atomic.406" = type { %"struct.std::__atomic_base.407" }
%"struct.std::__atomic_base.407" = type { ptr }
%"struct.std::atomic.408" = type { %"struct.std::__atomic_base.409" }
%"struct.std::__atomic_base.409" = type { ptr }
%class.InsertOnlyConcurrentMap = type { %class.ConcurrentContainer.411 }
%class.ConcurrentContainer.411 = type { ptr, [83 x %"class.cc_impl::ConcurrentHashtable.412"] }
%"class.cc_impl::ConcurrentHashtable.412" = type { %"struct.std::atomic.413", %"struct.std::atomic.130", %"struct.std::atomic.132", %"struct.std::atomic.415" }
%"struct.std::atomic.413" = type { %"struct.std::__atomic_base.414" }
%"struct.std::__atomic_base.414" = type { ptr }
%"struct.std::atomic.415" = type { %"struct.std::__atomic_base.416" }
%"struct.std::__atomic_base.416" = type { ptr }

@.str.10 = external hidden unnamed_addr constant [109 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [26 x i8], align 1
@__PRETTY_FUNCTION__._ZNK20constant_propagation31ImmutableAttributeAnalyzerState23may_be_initialized_typeEP7DexType = external hidden unnamed_addr constant [101 x i8], align 1

; 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

; Function Attrs: noreturn
declare void @_Z11assert_failPKcS0_jS0_10RedexErrorS0_z(ptr noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK20constant_propagation31ImmutableAttributeAnalyzerState23may_be_initialized_typeEP7DexType(ptr noundef nonnull align 8 dereferenceable(16696) %0, ptr noundef %1) #3 align 2 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %"struct.std::pair.459", align 8
  %7 = alloca %class.anon.462, align 8
  %8 = alloca { ptr, i8 }, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %9 = load ptr, ptr %4, align 8
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = icmp eq ptr %10, null
  br i1 %11, label %15, label %12

12:                                               ; preds = %2
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = call noundef zeroext i1 @_ZN4type8is_arrayEPK7DexType(ptr noundef %13)
  br i1 %14, label %15, label %16

15:                                               ; preds = %12, %2
  store i1 false, ptr %3, align 1
  br label %31

16:                                               ; preds = %12
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = call noundef zeroext i1 @_ZN4type12is_primitiveEPK7DexType(ptr noundef %17)
  br i1 %18, label %20, label %19

19:                                               ; preds = %16
  br label %22

20:                                               ; preds = %16
  call void (ptr, ptr, i32, ptr, i32, ptr, ...) @_Z11assert_failPKcS0_jS0_10RedexErrorS0_z(ptr noundef @.str.33, ptr noundef @.str.10, i32 noundef 1284, ptr noundef @__PRETTY_FUNCTION__._ZNK20constant_propagation31ImmutableAttributeAnalyzerState23may_be_initialized_typeEP7DexType, i32 noundef 2, ptr noundef @.str.26) #5
  unreachable

21:                                               ; No predecessors!
  br label %22

22:                                               ; preds = %21, %19
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #6
  %23 = getelementptr inbounds %"struct.constant_propagation::ImmutableAttributeAnalyzerState", ptr %9, i32 0, i32 5
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #6
  %24 = getelementptr inbounds %class.anon.462, ptr %7, i32 0, i32 0
  store ptr %9, ptr %24, align 8, !tbaa !9
  %25 = getelementptr inbounds %class.anon.462, ptr %7, i32 0, i32 1
  store ptr %5, ptr %25, align 8, !tbaa !5
  %26 = call { ptr, i8 } @"_ZN23InsertOnlyConcurrentMapIP7DexTypebSt4hashIS1_ESt8equal_toIS1_ELm83EE30get_or_create_and_assert_equalIS4_IbEZNK20constant_propagation31ImmutableAttributeAnalyzerState23may_be_initialized_typeES1_E3$_0JEEESt4pairIPKbbERKS1_RKT0_DpOT1_"(ptr noundef nonnull align 8 dereferenceable(2664) %23, ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(16) %7)
  store { ptr, i8 } %26, ptr %8, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %6, ptr align 8 %8, i64 9, i1 false)
  %27 = getelementptr inbounds %"struct.std::pair.459", ptr %6, i32 0, i32 0
  %28 = load ptr, ptr %27, align 8, !tbaa !11
  %29 = load i8, ptr %28, align 1, !tbaa !14, !range !15, !noundef !16
  %30 = trunc i8 %29 to i1
  store i1 %30, ptr %3, align 1
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #6
  br label %31

31:                                               ; preds = %22, %15
  %32 = load i1, ptr %3, align 1
  ret i1 %32
}

declare noundef zeroext i1 @_ZN4type12is_primitiveEPK7DexType(ptr noundef) #4

declare noundef zeroext i1 @_ZN4type8is_arrayEPK7DexType(ptr noundef) #4

; Function Attrs: mustprogress uwtable
declare hidden { ptr, i8 } @"_ZN23InsertOnlyConcurrentMapIP7DexTypebSt4hashIS1_ESt8equal_toIS1_ELm83EE30get_or_create_and_assert_equalIS4_IbEZNK20constant_propagation31ImmutableAttributeAnalyzerState23may_be_initialized_typeES1_E3$_0JEEESt4pairIPKbbERKS1_RKT0_DpOT1_"(ptr noundef nonnull align 8 dereferenceable(2664), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(16)) #3 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { "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 = { noreturn }
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"}
!9 = !{!10, !6, i64 0}
!10 = !{!"_ZTSZNK20constant_propagation31ImmutableAttributeAnalyzerState23may_be_initialized_typeEP7DexTypeE3$_0", !6, i64 0, !6, i64 8}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTSSt4pairIPKbbE", !6, i64 0, !13, i64 8}
!13 = !{!"bool", !7, i64 0}
!14 = !{!13, !13, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}


; 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.anon.462 = type { ptr, ptr }

@.str.10 = external hidden unnamed_addr constant [109 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [26 x i8], align 1
@__PRETTY_FUNCTION__._ZNK20constant_propagation31ImmutableAttributeAnalyzerState23may_be_initialized_typeEP7DexType = external hidden unnamed_addr constant [101 x i8], align 1

; 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

; Function Attrs: noreturn
declare void @_Z11assert_failPKcS0_jS0_10RedexErrorS0_z(ptr noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK20constant_propagation31ImmutableAttributeAnalyzerState23may_be_initialized_typeEP7DexType(ptr noundef nonnull align 8 dereferenceable(16696) %0, ptr noundef %1) local_unnamed_addr #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca %class.anon.462, align 8
  store ptr %1, ptr %3, align 8, !tbaa !5
  %5 = icmp eq ptr %1, null
  br i1 %5, label %17, label %6

6:                                                ; preds = %2
  %7 = tail call noundef zeroext i1 @_ZN4type8is_arrayEPK7DexType(ptr noundef nonnull %1)
  br i1 %7, label %17, label %8

8:                                                ; preds = %6
  %9 = tail call noundef zeroext i1 @_ZN4type12is_primitiveEPK7DexType(ptr noundef nonnull %1)
  br i1 %9, label %10, label %11

10:                                               ; preds = %8
  tail call void (ptr, ptr, i32, ptr, i32, ptr, ...) @_Z11assert_failPKcS0_jS0_10RedexErrorS0_z(ptr noundef nonnull @.str.33, ptr noundef nonnull @.str.10, i32 noundef 1284, ptr noundef nonnull @__PRETTY_FUNCTION__._ZNK20constant_propagation31ImmutableAttributeAnalyzerState23may_be_initialized_typeEP7DexType, i32 noundef 2, ptr noundef nonnull @.str.26) #4
  unreachable

11:                                               ; preds = %8
  %12 = getelementptr inbounds i8, ptr %0, i64 14032
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #5
  store ptr %0, ptr %4, align 8, !tbaa !9
  %13 = getelementptr inbounds i8, ptr %4, i64 8
  store ptr %3, ptr %13, align 8, !tbaa !5
  %14 = call { ptr, i8 } @"_ZN23InsertOnlyConcurrentMapIP7DexTypebSt4hashIS1_ESt8equal_toIS1_ELm83EE30get_or_create_and_assert_equalIS4_IbEZNK20constant_propagation31ImmutableAttributeAnalyzerState23may_be_initialized_typeES1_E3$_0JEEESt4pairIPKbbERKS1_RKT0_DpOT1_"(ptr noundef nonnull align 8 dereferenceable(2664) %12, ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(16) %4)
  %.fca.0.extract = extractvalue { ptr, i8 } %14, 0
  %15 = load i8, ptr %.fca.0.extract, align 1, !tbaa !11, !range !13, !noundef !14
  %16 = trunc nuw i8 %15 to i1
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #5
  br label %17

17:                                               ; preds = %2, %6, %11
  %.0 = phi i1 [ %16, %11 ], [ false, %6 ], [ false, %2 ]
  ret i1 %.0
}

declare noundef zeroext i1 @_ZN4type12is_primitiveEPK7DexType(ptr noundef) local_unnamed_addr #3

declare noundef zeroext i1 @_ZN4type8is_arrayEPK7DexType(ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare hidden { ptr, i8 } @"_ZN23InsertOnlyConcurrentMapIP7DexTypebSt4hashIS1_ESt8equal_toIS1_ELm83EE30get_or_create_and_assert_equalIS4_IbEZNK20constant_propagation31ImmutableAttributeAnalyzerState23may_be_initialized_typeES1_E3$_0JEEESt4pairIPKbbERKS1_RKT0_DpOT1_"(ptr noundef nonnull align 8 dereferenceable(2664), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn "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 = { "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 = { noreturn }
attributes #5 = { 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"}
!9 = !{!10, !6, i64 0}
!10 = !{!"_ZTSZNK20constant_propagation31ImmutableAttributeAnalyzerState23may_be_initialized_typeEP7DexTypeE3$_0", !6, i64 0, !6, i64 8}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}


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