Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CodeGen / dominating-store-infinite-cycle.c
blob2a9dbd384e6c22284ca4dccd5fdfee7205763113
1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2
2 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o - | FileCheck %s
4 // Test for PR62830 where there are 2 infinite cycles using goto. Make sure
5 // clang codegen doesn't hang.
6 int a;
8 // CHECK-LABEL: define dso_local i32 @main
9 // CHECK-SAME: () #[[ATTR0:[0-9]+]] {
10 // CHECK-NEXT: entry:
11 // CHECK-NEXT: [[RETVAL:%.*]] = alloca i32, align 4
12 // CHECK-NEXT: store i32 0, ptr [[RETVAL]], align 4
13 // CHECK-NEXT: br label [[L1:%.*]]
14 // CHECK: L1:
15 // CHECK-NEXT: br label [[L1]]
16 // CHECK: L2:
17 // CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr @a, align 4
18 // CHECK-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[TMP0]], 0
19 // CHECK-NEXT: br i1 [[TOBOOL]], label [[IF_END:%.*]], label [[IF_THEN:%.*]]
20 // CHECK: if.then:
21 // CHECK-NEXT: br label [[L2:%.*]]
22 // CHECK: if.end:
23 // CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[RETVAL]], align 4
24 // CHECK-NEXT: ret i32 [[TMP1]]
26 int main() {
27 L1:
28 goto L1;
30 L2:
31 if (!a)
32 goto L2;