1; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s 2; RUN: opt < %s -basicaa -gvn -S | FileCheck -check-prefix=CHECK-GVN %s 3 4; The input *.ll had been adapted from bug 37458: 5; 6; struct A { virtual void f(); int n; }; 7; 8; int h() { 9; A a; 10; a.n = 42; 11; return __builtin_launder(&a)->n; 12; } 13 14%struct.A = type <{ i8*, i8 }> 15 16; CHECK: testLaunderInvariantGroupIsNotEscapeSource 17; CHECK-GVN: testLaunderInvariantGroupIsNotEscapeSource 18define i8 @testLaunderInvariantGroupIsNotEscapeSource() { 19; CHECK-DAG: MustAlias: %struct.A* %a, i8* %a.bitcast 20; CHECK-DAG: PartialAlias: %struct.A* %a, i8* %n 21; CHECK-DAG: NoAlias: i8* %a.bitcast, i8* %n 22; CHECK-DAG: MustAlias: %struct.A* %a, i8* %a.laundered 23; CHECK-DAG: MustAlias: i8* %a.bitcast, i8* %a.laundered 24; CHECK-DAG: NoAlias: i8* %a.laundered, i8* %n 25; CHECK-DAG: PartialAlias: %struct.A* %a, i8* %n.laundered 26; CHECK-DAG: NoAlias: i8* %a.bitcast, i8* %n.laundered 27; CHECK-DAG: MustAlias: i8* %n, i8* %n.laundered 28; CHECK-DAG: NoAlias: i8* %a.laundered, i8* %n.laundered 29; CHECK-DAG: NoModRef: Ptr: %struct.A* %a <-> %a.laundered = call i8* @llvm.launder.invariant.group.p0i8(i8* nonnull %a.bitcast) 30; CHECK-DAG: NoModRef: Ptr: i8* %a.bitcast <-> %a.laundered = call i8* @llvm.launder.invariant.group.p0i8(i8* nonnull %a.bitcast) 31; CHECK-DAG: NoModRef: Ptr: i8* %n <-> %a.laundered = call i8* @llvm.launder.invariant.group.p0i8(i8* nonnull %a.bitcast) 32; CHECK-DAG: NoModRef: Ptr: i8* %a.laundered <-> %a.laundered = call i8* @llvm.launder.invariant.group.p0i8(i8* nonnull %a.bitcast) 33; CHECK-DAG: NoModRef: Ptr: i8* %n.laundered <-> %a.laundered = call i8* @llvm.launder.invariant.group.p0i8(i8* nonnull %a.bitcast) 34 35entry: 36 %a = alloca %struct.A, align 8 37 %a.bitcast = bitcast %struct.A* %a to i8* 38 %n = getelementptr inbounds %struct.A, %struct.A* %a, i64 0, i32 1 39 store i8 42, i8* %n 40 %a.laundered = call i8* @llvm.launder.invariant.group.p0i8(i8* nonnull %a.bitcast) 41 %n.laundered = getelementptr inbounds i8, i8* %a.laundered, i64 8 42 %v = load i8, i8* %n.laundered 43; make sure that the load from %n.laundered to %v aliases the store of 42 to %n 44; CHECK-GVN: ret i8 42 45 ret i8 %v 46} 47 48declare i8* @llvm.launder.invariant.group.p0i8(i8*) 49