1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -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(double* %data) {
10 ; CHECK-LABEL: @test_double(
12 ; CHECK-NEXT: [[LUC:%.*]] = tail call noalias nonnull i64* @data()
13 ; CHECK-NEXT: store i64 1, i64* [[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 i64* @data()
26 store i64 1, i64* %luc, !invariant.group !0
27 %QQ = load i64, i64* %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, i64* %luc, !invariant.group !0
36 call void @fn(i64 %QQ.1)
42 declare noalias i64* @data()
45 define void @test_double_ptr(double** %data) {
46 ; CHECK-LABEL: @test_double_ptr(
48 ; CHECK-NEXT: [[LUC:%.*]] = tail call noalias nonnull i64** @data.ptr()
49 ; CHECK-NEXT: store i64* null, i64** [[LUC]], align 8, !invariant.group !0
50 ; CHECK-NEXT: call void @fn.ptr(i64* 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(i64* null)
58 ; CHECK-NEXT: ret void
61 %luc = tail call noalias nonnull i64** @data.ptr()
62 store i64* null, i64** %luc, !invariant.group !0
63 %QQ = load i64*, i64** %luc, !invariant.group !0
64 call void @fn.ptr(i64* %QQ)
65 br i1 true, label %A, label %B
70 B: ; preds = %A, %loop
71 %QQ.1 = load i64*, i64** %luc, !invariant.group !0
72 call void @fn.ptr(i64* %QQ.1)
77 declare void @fn.ptr(i64 *)
79 declare noalias i64** @data.ptr()