brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 8025c97 Raw
38 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; Test to make sure llvm.invariant.start calls are not treated as clobbers.3; RUN: opt < %s -passes=dse -S | FileCheck %s4 5declare ptr @llvm.invariant.start.p0(i64, ptr nocapture) nounwind readonly6 7; We could remove either store here. The first store is dead in the8; conventional sense, because there is a later killing store. The second store9; is undefined behavior by the semantics of invariant.start, and as such10; unreachable.11define void @test(ptr %p) {12; CHECK-LABEL: @test(13; CHECK-NEXT:    store i8 3, ptr [[P:%.*]], align 414; CHECK-NEXT:    ret void15;16  store i8 1, ptr %p, align 417  %i = call ptr @llvm.invariant.start.p0(i64 1, ptr %p)18  store i8 3, ptr %p, align 419  ret void20}21 22; FIXME: We should be able to remove the first store to p, even though p and q23; may alias.24define void @test2(ptr %p, ptr %q) {25; CHECK-LABEL: @test2(26; CHECK-NEXT:    store i8 1, ptr [[P:%.*]], align 427; CHECK-NEXT:    store i8 2, ptr [[Q:%.*]], align 428; CHECK-NEXT:    [[I:%.*]] = call ptr @llvm.invariant.start.p0(i64 1, ptr [[Q]])29; CHECK-NEXT:    store i8 3, ptr [[P]], align 430; CHECK-NEXT:    ret void31;32  store i8 1, ptr %p, align 433  store i8 2, ptr %q, align 434  %i = call ptr @llvm.invariant.start.p0(i64 1, ptr %q)35  store i8 3, ptr %p, align 436  ret void37}38