1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals 2; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT 3; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC 4; 5; FIXME: The GEP + BC + GEP solution we create is not great but correct. 6 7declare void @use(i32* nocapture readonly %arg) 8 9define void @caller() { 10; TUNIT-LABEL: define {{[^@]+}}@caller() { 11; TUNIT-NEXT: entry: 12; TUNIT-NEXT: [[LEFT:%.*]] = alloca [3 x i32], align 4 13; TUNIT-NEXT: [[ARRAYDECAY:%.*]] = getelementptr inbounds [3 x i32], [3 x i32]* [[LEFT]], i64 0, i64 0 14; TUNIT-NEXT: [[TMP0:%.*]] = bitcast i32* [[ARRAYDECAY]] to [3 x i32]* 15; TUNIT-NEXT: [[DOTCAST:%.*]] = bitcast [3 x i32]* [[TMP0]] to i32* 16; TUNIT-NEXT: [[TMP1:%.*]] = load i32, i32* [[DOTCAST]], align 4 17; TUNIT-NEXT: [[DOT0_1:%.*]] = getelementptr [3 x i32], [3 x i32]* [[TMP0]], i64 0, i64 1 18; TUNIT-NEXT: [[TMP2:%.*]] = load i32, i32* [[DOT0_1]], align 4 19; TUNIT-NEXT: [[DOT0_2:%.*]] = getelementptr [3 x i32], [3 x i32]* [[TMP0]], i64 0, i64 2 20; TUNIT-NEXT: [[TMP3:%.*]] = load i32, i32* [[DOT0_2]], align 4 21; TUNIT-NEXT: call void @callee(i32 [[TMP1]], i32 [[TMP2]], i32 [[TMP3]]) 22; TUNIT-NEXT: ret void 23; 24; CGSCC-LABEL: define {{[^@]+}}@caller() { 25; CGSCC-NEXT: entry: 26; CGSCC-NEXT: call void @callee(i32 undef, i32 undef, i32 undef) 27; CGSCC-NEXT: ret void 28; 29entry: 30 %left = alloca [3 x i32], align 4 31 %arraydecay = getelementptr inbounds [3 x i32], [3 x i32]* %left, i64 0, i64 0 32 call void @callee(i32* %arraydecay) 33 ret void 34} 35 36define internal void @callee(i32* noalias %arg) { 37; CHECK-LABEL: define {{[^@]+}}@callee 38; CHECK-SAME: (i32 [[TMP0:%.*]], i32 [[TMP1:%.*]], i32 [[TMP2:%.*]]) { 39; CHECK-NEXT: entry: 40; CHECK-NEXT: [[ARG_PRIV:%.*]] = alloca [3 x i32], align 4 41; CHECK-NEXT: [[ARG_PRIV_CAST:%.*]] = bitcast [3 x i32]* [[ARG_PRIV]] to i32* 42; CHECK-NEXT: store i32 [[TMP0]], i32* [[ARG_PRIV_CAST]], align 4 43; CHECK-NEXT: [[ARG_PRIV_0_1:%.*]] = getelementptr [3 x i32], [3 x i32]* [[ARG_PRIV]], i64 0, i64 1 44; CHECK-NEXT: store i32 [[TMP1]], i32* [[ARG_PRIV_0_1]], align 4 45; CHECK-NEXT: [[ARG_PRIV_0_2:%.*]] = getelementptr [3 x i32], [3 x i32]* [[ARG_PRIV]], i64 0, i64 2 46; CHECK-NEXT: store i32 [[TMP2]], i32* [[ARG_PRIV_0_2]], align 4 47; CHECK-NEXT: [[TMP3:%.*]] = bitcast [3 x i32]* [[ARG_PRIV]] to i32* 48; CHECK-NEXT: call void @use(i32* noalias nocapture noundef nonnull readonly align 4 dereferenceable(12) [[TMP3]]) 49; CHECK-NEXT: ret void 50; 51entry: 52 call void @use(i32* %arg) 53 ret void 54} 55