1 ; RUN: opt %loadPolly %defaultOpts -polly-codegen -enable-polly-vector -dce -S %s | FileCheck %s
2 ; Obtained from C source as:
3 ; clang -S -emit-llvm -O0 pr43842.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer pr43842.s > pr43842.ll
6 ; ModuleID = 'pr43842.s'
7 target 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"
8 target triple = "x86_64-unknown-linux-gnu"
10 @g_4 = common global i16 0, align 2
11 @g_9 = common global [1 x i32] zeroinitializer, align 4
12 @g_4_8 = common global i8 0, align 1
13 @g_9_8 = common global [2 x i32] zeroinitializer, align 4
15 define i32 @int161() nounwind uwtable {
19 for.cond: ; preds = %for.inc, %entry
20 %l_2.0 = phi i32 [ -25, %entry ], [ %call4, %for.inc ]
21 %tobool = icmp eq i32 %l_2.0, 0
22 br i1 %tobool, label %for.end, label %for.body
24 for.body: ; preds = %for.cond
25 %tmp1 = load i16* @g_4, align 2
26 %call = call signext i16 @safe_rshift_func_int16_t_s_u(i16 signext %tmp1, i32 1)
27 %conv = sext i16 %call to i32
28 %tmp2 = load i32* getelementptr inbounds ([1 x i32]* @g_9, i64 0, i64 0), align 4
29 %xor = xor i32 %tmp2, %conv
30 store i32 %xor, i32* getelementptr inbounds ([1 x i32]* @g_9, i64 0, i64 0), align 4
33 for.inc: ; preds = %for.body
34 %call4 = call i32 @safe_add_func_uint32_t_u_u(i32 %l_2.0, i16 zeroext 1)
37 for.end: ; preds = %for.cond
41 define internal signext i16 @safe_rshift_func_int16_t_s_u(i16 signext %left, i32 %right) nounwind uwtable {
43 %tobool = icmp eq i16 %left, 0
44 br i1 %tobool, label %lor.lhs.false, label %cond.true
46 lor.lhs.false: ; preds = %entry
47 %cmp = icmp ugt i32 %right, 7
48 br i1 %cmp, label %cond.true, label %cond.false
50 cond.true: ; preds = %entry, %lor.lhs.false
51 %conv4 = sext i16 %left to i32
54 cond.false: ; preds = %lor.lhs.false
55 %conv6 = sext i16 %left to i32
56 %shr = ashr i32 %conv6, %right
59 cond.end: ; preds = %cond.false, %cond.true
60 %cond = phi i32 [ %conv4, %cond.true ], [ %shr, %cond.false ]
61 %conv8 = trunc i32 %cond to i16
65 define internal i32 @safe_add_func_uint32_t_u_u(i32 %ui1, i16 zeroext %ui2) nounwind uwtable {
67 %conv = zext i16 %ui2 to i32
68 %add = add i32 %conv, %ui1
72 define i32 @int81() nounwind uwtable {
76 for.cond: ; preds = %for.inc, %entry
77 %l_2.0 = phi i32 [ -25, %entry ], [ %call9, %for.inc ]
78 %tobool = icmp eq i32 %l_2.0, 0
79 br i1 %tobool, label %for.end, label %for.body
81 for.body: ; preds = %for.cond
82 %tmp1 = load i8* @g_4_8, align 1
83 %call = call signext i8 @safe_rshift_func_int8_t_s_u(i8 signext %tmp1, i32 1)
84 %conv = sext i8 %call to i32
85 %tmp2 = load i32* getelementptr inbounds ([1 x i32]* @g_9, i64 0, i64 0), align 4
86 %xor = xor i32 %tmp2, %conv
87 store i32 %xor, i32* getelementptr inbounds ([1 x i32]* @g_9, i64 0, i64 0), align 4
88 %tmp3 = load i8* @g_4_8, align 1
89 %call4 = call signext i8 @safe_rshift_func_int8_t_s_u(i8 signext %tmp3, i32 1)
90 %conv5 = sext i8 %call4 to i32
91 %tmp6 = load i32* getelementptr inbounds ([1 x i32]* @g_9, i64 1, i64 0), align 4
92 %xor7 = xor i32 %tmp6, %conv5
93 store i32 %xor7, i32* getelementptr inbounds ([1 x i32]* @g_9, i64 1, i64 0), align 4
96 for.inc: ; preds = %for.body
97 %call9 = call i32 @safe_add_func_uint32_t_u_u(i32 %l_2.0, i16 zeroext 1)
100 for.end: ; preds = %for.cond
104 define internal signext i8 @safe_rshift_func_int8_t_s_u(i8 signext %left, i32 %right) nounwind uwtable {
106 %tobool = icmp eq i8 %left, 0
107 br i1 %tobool, label %lor.lhs.false, label %cond.true
109 lor.lhs.false: ; preds = %entry
110 %cmp = icmp ugt i32 %right, 7
111 br i1 %cmp, label %cond.true, label %cond.false
113 cond.true: ; preds = %entry, %lor.lhs.false
114 %conv4 = sext i8 %left to i32
117 cond.false: ; preds = %lor.lhs.false
118 %conv6 = sext i8 %left to i32
119 %shr = ashr i32 %conv6, %right
122 cond.end: ; preds = %cond.false, %cond.true
123 %cond = phi i32 [ %conv4, %cond.true ], [ %shr, %cond.false ]
124 %conv8 = trunc i32 %cond to i8