1 ; RUN: opt %loadPolly -polly-codegen -S < %s | FileCheck %s
3 ; This caused the code generation to generate invalid code as the same operand
4 ; of the PHI node in the non-affine region was synthesized at the wrong place.
5 ; Check we do not generate wrong code.
9 ; ModuleID = 'bugpoint-reduced-simplified.bc'
10 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
12 @connected_passed = external global [256 x i8], align 16
14 ; Function Attrs: norecurse nounwind uwtable
15 define void @InitializeZeroMasks() {
19 for.end20: ; preds = %entry
22 for.body24: ; preds = %for.body61.preheader, %for.end20
23 %indvars.iv = phi i64 [ 0, %for.end20 ], [ %indvars.iv.next, %for.body61.preheader ]
24 %arrayidx26 = getelementptr inbounds [256 x i8], ptr @connected_passed, i64 0, i64 %indvars.iv
25 store i8 0, ptr %arrayidx26, align 1
26 %0 = trunc i64 %indvars.iv to i32
27 br i1 false, label %for.inc56.4, label %if.then51
29 if.then51: ; preds = %for.inc56.5, %for.body24
30 %j.342.lcssa = phi i8 [ 7, %for.body24 ], [ %.mux, %for.inc56.5 ]
31 br label %for.body61.preheader
33 for.body61.preheader: ; preds = %for.inc56.5, %if.then51
34 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
35 %exitcond = icmp eq i64 %indvars.iv.next, 256
36 br i1 %exitcond, label %for.end79, label %for.body24
38 for.end79: ; preds = %for.body61.preheader
41 for.inc56.4: ; preds = %for.body24
44 for.inc56.5: ; preds = %for.inc56.4
45 %and49.6 = and i32 %0, 64
46 %brmerge = or i1 undef, undef
47 %and49.6.lobit = lshr exact i32 %and49.6, 6
48 %.mux = trunc i32 %and49.6.lobit to i8
49 br i1 %brmerge, label %if.then51, label %for.body61.preheader