diff --git a/llvm/test/CodeGen/VE/Scalar/D91151-test.ll b/llvm/test/CodeGen/VE/Scalar/D91151-test.ll new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/VE/Scalar/D91151-test.ll @@ -0,0 +1,125 @@ +; RUN: llc < %s -mtriple=ve | FileCheck %s + +;; Check that a situation D91151 (https://reviews.llvm.org/D91151) happens. + +%union.kmp_info = type { %struct.kmp_base_info } +%struct.kmp_base_info = type { %union.kmp_desc, %union.kmp_team*, %union.kmp_root*, %union.kmp_info*, %struct.kmp_disp*, i32, i32, %union.kmp_info*, i32, void (i32*, i32*, ...)*, i32, i64, %"class.KMPAffinity::Mask"*, i8*, [32 x i8], i32, %struct.kmp_hot_team_ptr*, i32, %struct.kmp_teams_size, i32, i32, i32, i32, i32, i32, i64, i64, i64, %struct.kmp_local, %struct.private_common*, %union.kmp_team*, %struct.common_table*, i32, i8*, %struct.ident*, i32, i32, %union.kmp_task_team*, %struct.kmp_taskdata*, i8, i8*, i32, i32, i32, i8, i32, %struct.cons_header*, [16 x i8], [3 x %union.kmp_barrier_union], i32, [4 x %struct.kmp_free_list], [24 x i8], %union.kmp_cond_union, %union.kmp_mutex_union, %"struct.std::__1::atomic", i32, %"struct.std::__1::atomic.5", %struct.kmp_cg_root*, [40 x i8] } +%union.kmp_desc = type { %struct.kmp_desc_base, [24 x i8] } +%struct.kmp_desc_base = type { i8*, i64, i32, i64, i32, i32 } +%union.kmp_root = type { %struct.kmp_base_root } +%struct.kmp_base_root = type { i32, %"struct.std::__1::atomic", %union.kmp_team*, %union.kmp_team*, %union.kmp_info*, [32 x i8], %union.kmp_ticket_lock, i32, i32, [56 x i8] } +%union.kmp_ticket_lock = type { %struct.kmp_lock_pool, [48 x i8] } +%struct.kmp_lock_pool = type { %union.kmp_user_lock*, i32 } +%union.kmp_user_lock = type { %union.kmp_drdpa_lock } +%union.kmp_drdpa_lock = type { %struct.kmp_lock_pool, [176 x i8] } +%struct.kmp_disp = type { void (i32*, i32*, %struct.ident*)*, void (i32*, i32*, %struct.ident*)*, %struct.dispatch_shared_info*, %struct.dispatch_private_info*, %struct.dispatch_private_info*, i32, i32, i32*, i64* } +%struct.dispatch_shared_info = type { %"union.dispatch_shared_info::shared_info", i32, i32, i32*, i32 } +%"union.dispatch_shared_info::shared_info" = type { %struct.dispatch_shared_info64 } +%struct.dispatch_shared_info64 = type { i64, i64, i64, [5 x i64] } +%struct.dispatch_private_info = type { %"union.dispatch_private_info::private_info", i32, %struct.kmp_sched_flags, i32, [5 x i32], %struct.dispatch_private_info*, i32, i32, [16 x i8] } +%"union.dispatch_private_info::private_info" = type { %struct.dispatch_private_info32 } +%struct.dispatch_private_info32 = type { i32, i32, i32, i32, i32, i32, %union.kmp_ticket_lock*, %struct.anon.14, i32, i32, [56 x i8] } +%struct.anon.14 = type { i32, i32, i32, i32, [16 x i8] } +%struct.kmp_sched_flags = type { i32 } +%"class.KMPAffinity::Mask" = type { i32 (...)** } +%struct.kmp_hot_team_ptr = type { %union.kmp_team*, i32 } +%struct.kmp_teams_size = type { i32, i32 } +%struct.kmp_local = type { i32, i8*, i8*, i8*, i32 } +%struct.private_common = type { %struct.private_common*, %struct.private_common*, i8*, i8*, i64 } +%union.kmp_team = type { %struct.kmp_base_team } +%struct.kmp_base_team = type { %union.kmp_ordered_team, [3 x %union.kmp_barrier_team_union], %"struct.std::__1::atomic", [64 x i8], [2 x %"struct.std::__1::atomic.1"], [2 x %"struct.std::__1::atomic"], [32 x i8], i32, i32, %struct.ident*, %union.kmp_team*, %union.kmp_team*, %struct.kmp_disp*, [2 x %union.kmp_task_team*], i32, i64, [56 x i8], i8**, i32, i32, void (i32*, i32*, ...)*, i32 (i32)*, [12 x i8*], %union.kmp_info**, %struct.kmp_taskdata*, i32, [44 x i8], i32, i32, i32, %struct.dispatch_shared_info*, i32, i32, %union.kmp_r_sched, i32, i32, i32, i32, i8*, %struct.kmp_internal_control*, %"struct.std::__1::atomic", i32, i8*, i8*, [32 x i8] } +%union.kmp_ordered_team = type { double, [56 x i8] } +%union.kmp_barrier_team_union = type { double, [56 x i8] } +%"struct.std::__1::atomic.1" = type { %"struct.std::__1::__atomic_base.2" } +%"struct.std::__1::__atomic_base.2" = type { %"struct.std::__1::__cxx_atomic_impl.3" } +%"struct.std::__1::__cxx_atomic_impl.3" = type { %"struct.std::__1::__cxx_atomic_base_impl.4" } +%"struct.std::__1::__cxx_atomic_base_impl.4" = type { i8* } +%union.kmp_r_sched = type { i64 } +%struct.kmp_internal_control = type { i32, i8, i8, i32, i32, i32, i32, %union.kmp_r_sched, i32, i32, %struct.kmp_internal_control* } +%struct.common_table = type { [512 x %struct.private_common*] } +%struct.ident = type { i32, i32, i32, i32, i8* } +%union.kmp_task_team = type { double, [248 x i8] } +%struct.kmp_taskdata = type { i32, %struct.kmp_tasking_flags, %union.kmp_team*, %union.kmp_info*, %struct.kmp_taskdata*, i32, %"struct.std::__1::atomic", %struct.ident*, %struct.ident*, i32, i32, %struct.kmp_internal_control, [16 x i8], %"struct.std::__1::atomic", %"struct.std::__1::atomic", %struct.kmp_taskgroup*, %struct.kmp_dephash*, %union.kmp_depnode*, %union.kmp_task_team*, i32, i32, %struct.kmp_taskdata*, void (i8*, i8*)*, %struct.kmp_event_t, [32 x i8] } +%struct.kmp_tasking_flags = type { i32 } +%struct.kmp_taskgroup = type <{ %"struct.std::__1::atomic", %"struct.std::__1::atomic", %struct.kmp_taskgroup*, i8*, i32, [4 x i8] }> +%struct.kmp_dephash = type { %struct.kmp_dephash_entry**, i64, i64, i32, i32 } +%struct.kmp_dephash_entry = type { i64, %union.kmp_depnode*, %struct.kmp_depnode_list*, %struct.kmp_depnode_list*, i32, %union.kmp_ticket_lock*, %struct.kmp_dephash_entry* } +%struct.kmp_depnode_list = type { %union.kmp_depnode*, %struct.kmp_depnode_list* } +%union.kmp_depnode = type { %struct.kmp_base_depnode } +%struct.kmp_base_depnode = type { %struct.kmp_depnode_list*, %struct.kmp_task*, [4 x %union.kmp_ticket_lock*], i32, [12 x i8], %union.kmp_ticket_lock, %"struct.std::__1::atomic", %"struct.std::__1::atomic", [56 x i8] } +%struct.kmp_task = type { i8*, i32 (i32, i8*)*, i32, %union.kmp_cmplrdata, %union.kmp_cmplrdata } +%union.kmp_cmplrdata = type { i32 (i32, i8*)* } +%struct.kmp_event_t = type { i32, %union.kmp_tas_lock, %union.anon } +%union.kmp_tas_lock = type { %struct.kmp_lock_pool } +%union.anon = type { %struct.kmp_task* } +%struct.cons_header = type { i32, i32, i32, i32, i32, %struct.cons_data* } +%struct.cons_data = type { %struct.ident*, i32, i32, %union.kmp_user_lock* } +%union.kmp_barrier_union = type { %struct.kmp_bstate } +%struct.kmp_bstate = type { %struct.kmp_internal_control, i64, [8 x i8], i64, i32*, i32, i32, i32, i32, %struct.kmp_bstate*, %union.kmp_team*, i64, i32, i8, i8, i8, i8, i8, [63 x i8] } +%struct.kmp_free_list = type { i8*, i8*, i8* } +%union.kmp_cond_union = type { %union.pthread_cond_t, [16 x i8] } +%union.pthread_cond_t = type { %struct.anon.17 } +%struct.anon.17 = type { i32, i32, i64, i64, i64, i8*, i32, i32 } +%union.kmp_mutex_union = type { %union.pthread_mutex_t, [24 x i8] } +%union.pthread_mutex_t = type { %"struct.(anonymous union)::__pthread_mutex_s" } +%"struct.(anonymous union)::__pthread_mutex_s" = type { i32, i32, i32, i32, i32, i32, %struct.__pthread_internal_list } +%struct.__pthread_internal_list = type { %struct.__pthread_internal_list*, %struct.__pthread_internal_list* } +%"struct.std::__1::atomic" = type { %"struct.std::__1::__atomic_base" } +%"struct.std::__1::__atomic_base" = type { %"struct.std::__1::__atomic_base.0" } +%"struct.std::__1::__atomic_base.0" = type { %"struct.std::__1::__cxx_atomic_impl" } +%"struct.std::__1::__cxx_atomic_impl" = type { %"struct.std::__1::__cxx_atomic_base_impl" } +%"struct.std::__1::__cxx_atomic_base_impl" = type { i32 } +%"struct.std::__1::atomic.5" = type { %"struct.std::__1::__atomic_base.6" } +%"struct.std::__1::__atomic_base.6" = type { %"struct.std::__1::__cxx_atomic_impl.7" } +%"struct.std::__1::__cxx_atomic_impl.7" = type { %"struct.std::__1::__cxx_atomic_base_impl.8" } +%"struct.std::__1::__cxx_atomic_base_impl.8" = type { i8 } +%struct.kmp_cg_root = type { %union.kmp_info*, i32, i32, %struct.kmp_cg_root* } + +@__kmp_threads = external local_unnamed_addr global %union.kmp_info**, align 8 +@__kmp_omp_cancellation = external local_unnamed_addr global i32, align 4 + +; Function Attrs: nounwind mustprogress +define signext i32 @__kmpc_cancel_barrier(%struct.ident* %loc, i32 signext %gtid) local_unnamed_addr { +; CHECK-LABEL: __kmpc_cancel_barrier +entry: + %0 = load %union.kmp_info**, %union.kmp_info*** @__kmp_threads, align 8 + %idxprom = sext i32 %gtid to i64 + %arrayidx = getelementptr inbounds %union.kmp_info*, %union.kmp_info** %0, i64 %idxprom + %1 = bitcast %union.kmp_info** %arrayidx to %struct.kmp_base_info** + %2 = load %struct.kmp_base_info*, %struct.kmp_base_info** %1, align 8 + %th_team = getelementptr inbounds %struct.kmp_base_info, %struct.kmp_base_info* %2, i64 0, i32 1 + %3 = bitcast %union.kmp_team** %th_team to %struct.kmp_base_team** + %4 = load %struct.kmp_base_team*, %struct.kmp_base_team** %3, align 64 + %5 = load i32, i32* @__kmp_omp_cancellation, align 4 + %tobool.not = icmp eq i32 %5, 0 + br i1 %tobool.not, label %if.end, label %if.then + +if.then: ; preds = %entry + %__a_value.i.i = getelementptr inbounds %struct.kmp_base_team, %struct.kmp_base_team* %4, i64 0, i32 40, i32 0, i32 0, i32 0, i32 0, i32 0 + %6 = load atomic i32, i32* %__a_value.i.i monotonic, align 4 + switch i32 %6, label %sw.default [ + i32 1, label %sw.bb + i32 2, label %sw.bb4 + i32 3, label %sw.bb4 + i32 4, label %sw.bb8 + i32 0, label %if.end + ] + +sw.bb: ; preds = %if.then + store atomic i32 0, i32* %__a_value.i.i seq_cst, align 4 + br label %if.end + +sw.bb4: ; preds = %if.then, %if.then + store atomic i32 0, i32* %__a_value.i.i seq_cst, align 4 + br label %if.end + +sw.bb8: ; preds = %if.then + br label %if.end + +sw.default: ; preds = %if.then + br label %if.end + +if.end: ; preds = %sw.bb, %sw.bb4, %sw.bb8, %if.then, %sw.default, %entry + %ret.0 = phi i32 [ 0, %sw.default ], [ %6, %if.then ], [ 0, %sw.bb8 ], [ 1, %sw.bb4 ], [ 1, %sw.bb ], [ 0, %entry ] + ret i32 %ret.0 +}