Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CodeGen / attr-maybeundef-template.cpp
blob35d01b97b834706fd4a1983611690b0e58b78e36
1 // RUN: %clang_cc1 -triple x86_64-gnu-linux -emit-llvm %s -o - | FileCheck %s
3 // CHECK-LABEL: define{{.*}} void @{{.*}}test4{{.*}}(float
4 // CHECK-NEXT: entry:
5 // CHECK-NEXT: [[TMP2:%.*]] = alloca float, align 4
6 // CHECK-NEXT: store float [[TMP1:%.*]], ptr [[TMP2:%.*]], align 4
7 // CHECK-NEXT: ret void
9 // CHECK-LABEL: define{{.*}} void @{{.*}}test4{{.*}}(i32
10 // CHECK-NEXT: entry:
11 // CHECK-NEXT: [[TMP2:%.*]] = alloca i32, align 4
12 // CHECK-NEXT: store i32 [[TMP1:%.*]], ptr [[TMP2:%.*]], align 4
13 // CHECK-NEXT: ret void
15 // CHECK-LABEL: define{{.*}} void @{{.*}}test{{.*}}(
16 // CHECK-NEXT: entry:
17 // CHECK-NEXT: [[TMP1:%.*]] = alloca i32, align 4
18 // CHECK-NEXT: [[TMP2:%.*]] = alloca float, align 4
19 // CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr [[TMP1:%.*]], align 4
20 // CHECK-NEXT: [[TMP4:%.*]] = freeze i32 [[TMP3:%.*]]
21 // CHECK-NEXT: call void @{{.*}}test4{{.*}}(i32 noundef [[TMP4:%.*]])
22 // CHECK-NEXT: [[TMP5:%.*]] = load float, ptr [[TMP2:%.*]], align 4
23 // CHECK-NEXT: [[TMP6:%.*]] = freeze float [[TMP5:%.*]]
24 // CHECK-NEXT: call void @{{.*}}test4{{.*}}(float noundef [[TMP6:%.*]])
25 // CHECK-NEXT: ret void
27 template<class T>
28 void test4(T __attribute__((maybe_undef)) arg) {
29 return;
32 template
33 void test4<float>(float arg);
35 template
36 void test4<int>(int arg);
38 void test() {
39 int Var1;
40 float Var2;
41 test4<int>(Var1);
42 test4<float>(Var2);