Files
clang-p2996/llvm/test/Transforms/Attributor/ArgumentPromotion/array.ll
Nikita Popov 846709b287 [Attribute] Clean up test prefixes (NFC)
Now that the legacy PM is no longer tested, the huge matrix of
test prefixes used by attributor tests is no longer needed and very
confusing for the casual reader. Reduce the prefixes down to just
CHECK, TUNIT and CGSCC.
2022-09-23 11:08:11 +02:00

55 lines
2.8 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
; 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
; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC
;
; FIXME: The GEP + BC + GEP solution we create is not great but correct.
declare void @use(i32* nocapture readonly %arg)
define void @caller() {
; TUNIT-LABEL: define {{[^@]+}}@caller() {
; TUNIT-NEXT: entry:
; TUNIT-NEXT: [[LEFT:%.*]] = alloca [3 x i32], align 4
; TUNIT-NEXT: [[ARRAYDECAY:%.*]] = getelementptr inbounds [3 x i32], [3 x i32]* [[LEFT]], i64 0, i64 0
; TUNIT-NEXT: [[TMP0:%.*]] = bitcast i32* [[ARRAYDECAY]] to [3 x i32]*
; TUNIT-NEXT: [[DOTCAST:%.*]] = bitcast [3 x i32]* [[TMP0]] to i32*
; TUNIT-NEXT: [[TMP1:%.*]] = load i32, i32* [[DOTCAST]], align 4
; TUNIT-NEXT: [[DOT0_1:%.*]] = getelementptr [3 x i32], [3 x i32]* [[TMP0]], i64 0, i64 1
; TUNIT-NEXT: [[TMP2:%.*]] = load i32, i32* [[DOT0_1]], align 4
; TUNIT-NEXT: [[DOT0_2:%.*]] = getelementptr [3 x i32], [3 x i32]* [[TMP0]], i64 0, i64 2
; TUNIT-NEXT: [[TMP3:%.*]] = load i32, i32* [[DOT0_2]], align 4
; TUNIT-NEXT: call void @callee(i32 [[TMP1]], i32 [[TMP2]], i32 [[TMP3]])
; TUNIT-NEXT: ret void
;
; CGSCC-LABEL: define {{[^@]+}}@caller() {
; CGSCC-NEXT: entry:
; CGSCC-NEXT: call void @callee(i32 undef, i32 undef, i32 undef)
; CGSCC-NEXT: ret void
;
entry:
%left = alloca [3 x i32], align 4
%arraydecay = getelementptr inbounds [3 x i32], [3 x i32]* %left, i64 0, i64 0
call void @callee(i32* %arraydecay)
ret void
}
define internal void @callee(i32* noalias %arg) {
; CHECK-LABEL: define {{[^@]+}}@callee
; CHECK-SAME: (i32 [[TMP0:%.*]], i32 [[TMP1:%.*]], i32 [[TMP2:%.*]]) {
; CHECK-NEXT: entry:
; CHECK-NEXT: [[ARG_PRIV:%.*]] = alloca [3 x i32], align 4
; CHECK-NEXT: [[ARG_PRIV_CAST:%.*]] = bitcast [3 x i32]* [[ARG_PRIV]] to i32*
; CHECK-NEXT: store i32 [[TMP0]], i32* [[ARG_PRIV_CAST]], align 4
; CHECK-NEXT: [[ARG_PRIV_0_1:%.*]] = getelementptr [3 x i32], [3 x i32]* [[ARG_PRIV]], i64 0, i64 1
; CHECK-NEXT: store i32 [[TMP1]], i32* [[ARG_PRIV_0_1]], align 4
; CHECK-NEXT: [[ARG_PRIV_0_2:%.*]] = getelementptr [3 x i32], [3 x i32]* [[ARG_PRIV]], i64 0, i64 2
; CHECK-NEXT: store i32 [[TMP2]], i32* [[ARG_PRIV_0_2]], align 4
; CHECK-NEXT: [[TMP3:%.*]] = bitcast [3 x i32]* [[ARG_PRIV]] to i32*
; CHECK-NEXT: call void @use(i32* noalias nocapture noundef nonnull readonly align 4 dereferenceable(12) [[TMP3]])
; CHECK-NEXT: ret void
;
entry:
call void @use(i32* %arg)
ret void
}