xref: /llvm-project/clang/test/CodeGen/fake-use-while.c (revision 4424c44c8c4ec8e071f5c5999fba216d36fb92c9)
1*4424c44cSWolfgang Pieb // RUN: %clang_cc1 %s -emit-llvm -fextend-variable-liveness -o - | FileCheck %s
2*4424c44cSWolfgang Pieb //
3*4424c44cSWolfgang Pieb // Check we don't assert when there is no more code after a while statement
4*4424c44cSWolfgang Pieb // and the body of the while statement ends in a return, i.e. no insertion point
5*4424c44cSWolfgang Pieb // is available.
6*4424c44cSWolfgang Pieb 
7*4424c44cSWolfgang Pieb // CHECK: define{{.*}}foo
8*4424c44cSWolfgang Pieb // CHECK: call{{.*}}llvm.fake.use
9*4424c44cSWolfgang Pieb 
10*4424c44cSWolfgang Pieb void foo() {
11*4424c44cSWolfgang Pieb   {
12*4424c44cSWolfgang Pieb     while (1) {
13*4424c44cSWolfgang Pieb       int ret;
14*4424c44cSWolfgang Pieb       if (1)
15*4424c44cSWolfgang Pieb         return;
16*4424c44cSWolfgang Pieb     }
17*4424c44cSWolfgang Pieb   }
18*4424c44cSWolfgang Pieb }
19