xref: /llvm-project/polly/test/CodeGen/constant_condition.ll (revision e1f056f692d869708c1898d9d65a69ac5584a0ed)
1;RUN: opt %loadNPMPolly '-passes=polly-prepare,scop(print<polly-ast>)' -disable-output < %s 2>&1 | FileCheck %s
2
3;#include <string.h>
4;int A[1];
5;
6;void constant_condition () {
7;  int a = 0;
8;  int b = 0;
9;
10;  if (a == b)
11;    A[0] = 0;
12;  else
13;    A[0] = 1;
14;}
15;
16;int main () {
17;  int i;
18;
19;  A[0] = 2;
20;
21;  constant_condition();
22;
23;  return A[0];
24;}
25
26target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
27@A = common global [1 x i32] zeroinitializer, align 4 ; <ptr> [#uses=1]
28
29define void @constant_condition() nounwind {
30bb:
31  %tmp = icmp eq i32 0, 0                         ; <i1> [#uses=0]
32  br i1 true, label %bb1, label %bb2
33
34bb1:                                              ; preds = %bb
35  store i32 0, ptr @A
36  br label %bb3
37
38bb2:                                              ; preds = %bb
39  store i32 1, ptr @A
40  br label %bb3
41
42bb3:                                              ; preds = %bb2, %bb1
43  ret void
44}
45
46define i32 @main() nounwind {
47bb:
48  store i32 2, ptr @A
49  call void @constant_condition()
50  %tmp = load i32, ptr @A ; <i32> [#uses=1]
51  ret i32 %tmp
52}
53
54
55; CHECK: Stmt_bb1();
56