40 lines · plain
1; RUN: opt < %s -passes=licm -S | FileCheck %s2@b = external global i32, align 43@fn3.i = external global i32, align 44 5declare i32 @g() nounwind6 7define i32 @f() {8entry:9 br label %for.cond10 11for.cond: ; preds = %for.end, %entry12; CHECK-LABEL: for.cond:13; CHECK: store i32 0, ptr @b14 store i32 0, ptr @b, align 415 br i1 true, label %for.body.preheader, label %for.end16 17for.body.preheader: ; preds = %for.cond18 br label %for.body19 20for.body: ; preds = %for.body, %for.body.preheader21 %g.15 = phi i32 [ undef, %for.body ], [ 0, %for.body.preheader ]22 %0 = load i32, ptr @fn3.i, align 423 %call = call i32 @g()24 br i1 false, label %for.body, label %for.end.loopexit25 26for.end.loopexit: ; preds = %for.body27 br label %for.end28 29for.end: ; preds = %for.end.loopexit, %for.cond30 %whatever = phi i32 [ %call, %for.end.loopexit ], [ undef, %for.cond ]31 br i1 false, label %for.cond, label %if.then32 33if.then: ; preds = %for.end34; CHECK-LABEL: if.then:35; CHECK: phi i32 [ {{.*}}, %for.end ]36; CHECK-NOT: store i32 0, ptr @b37; CHECK: ret i3238 ret i32 %whatever39}40