35 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -S -passes=licm < %s | FileCheck %s3 4%class.LiveThread = type { i64, ptr }5 6@globallive = external dso_local global i64, align 87 8; The store should not be sunk (via scalar promotion) past the cmpxchg.9 10define void @test(ptr %live_thread) {11; CHECK-LABEL: @test(12; CHECK-NEXT: [[NEXT_UNPROCESSED_:%.*]] = getelementptr inbounds [[CLASS_LIVETHREAD:%.*]], ptr [[LIVE_THREAD:%.*]], i64 0, i32 113; CHECK-NEXT: br label [[LOOP:%.*]]14; CHECK: loop:15; CHECK-NEXT: store ptr undef, ptr [[NEXT_UNPROCESSED_]], align 816; CHECK-NEXT: [[XCHG:%.*]] = cmpxchg weak ptr @globallive, i64 undef, i64 undef release monotonic, align 817; CHECK-NEXT: [[DONE:%.*]] = extractvalue { i64, i1 } [[XCHG]], 118; CHECK-NEXT: br i1 [[DONE]], label [[EXIT:%.*]], label [[LOOP]]19; CHECK: exit:20; CHECK-NEXT: ret void21;22 %next_unprocessed_ = getelementptr inbounds %class.LiveThread, ptr %live_thread, i64 0, i32 123 br label %loop24 25loop:26 store ptr undef, ptr %next_unprocessed_, align 827 %xchg = cmpxchg weak ptr @globallive, i64 undef, i64 undef release monotonic, align 828 %done = extractvalue { i64, i1 } %xchg, 129 br i1 %done, label %exit, label %loop30 31exit:32 ret void33}34 35