1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=gvn -S %s | FileCheck %s
4 ; Test for PR46054. Make sure we correctly invalidate MemoryDependenceAnalysis,
5 ; after removing a nonlocaldef.
7 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
9 define void @test_double(ptr %data) {
10 ; CHECK-LABEL: @test_double(
12 ; CHECK-NEXT: [[LUC:%.*]] = tail call noalias nonnull ptr @data()
13 ; CHECK-NEXT: store i64 1, ptr [[LUC]], align 8, !invariant.group !0
14 ; CHECK-NEXT: call void @fn(i64 1)
15 ; CHECK-NEXT: br i1 true, label [[A:%.*]], label [[ENTRY_B_CRIT_EDGE:%.*]]
16 ; CHECK: entry.B_crit_edge:
17 ; CHECK-NEXT: br label [[B:%.*]]
19 ; CHECK-NEXT: br label [[B]]
21 ; CHECK-NEXT: call void @fn(i64 1)
22 ; CHECK-NEXT: ret void
25 %luc = tail call noalias nonnull ptr @data()
26 store i64 1, ptr %luc, !invariant.group !0
27 %QQ = load i64, ptr %luc, !invariant.group !0
28 call void @fn(i64 %QQ)
29 br i1 true, label %A, label %B
34 B: ; preds = %A, %loop
35 %QQ.1 = load i64, ptr %luc, !invariant.group !0
36 call void @fn(i64 %QQ.1)
42 declare noalias ptr @data()
45 define void @test_double_ptr(ptr %data) {
46 ; CHECK-LABEL: @test_double_ptr(
48 ; CHECK-NEXT: [[LUC:%.*]] = tail call noalias nonnull ptr @data.ptr()
49 ; CHECK-NEXT: store ptr null, ptr [[LUC]], align 8, !invariant.group !0
50 ; CHECK-NEXT: call void @fn.ptr(ptr null)
51 ; CHECK-NEXT: br i1 true, label [[A:%.*]], label [[ENTRY_B_CRIT_EDGE:%.*]]
52 ; CHECK: entry.B_crit_edge:
53 ; CHECK-NEXT: br label [[B:%.*]]
55 ; CHECK-NEXT: br label [[B]]
57 ; CHECK-NEXT: call void @fn.ptr(ptr null)
58 ; CHECK-NEXT: ret void
61 %luc = tail call noalias nonnull ptr @data.ptr()
62 store ptr null, ptr %luc, !invariant.group !0
63 %QQ = load ptr, ptr %luc, !invariant.group !0
64 call void @fn.ptr(ptr %QQ)
65 br i1 true, label %A, label %B
70 B: ; preds = %A, %loop
71 %QQ.1 = load ptr, ptr %luc, !invariant.group !0
72 call void @fn.ptr(ptr %QQ.1)
77 declare void @fn.ptr(ptr)
79 declare noalias ptr @data.ptr()