1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes=jump-threading,loop-rotate,instcombine,indvars,loop-unroll,simplifycfg -simplifycfg-require-and-preserve-domtree=1 -verify-dom-info -verify-loop-info < %s | FileCheck %s
4 ; Jump threading should not prevent this loop from being unrolled.
5 ; There should be 3 volatile stores and no branch
7 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
8 target triple = "i386-apple-darwin9.6"
9 @v1 = external global i32 ; <ptr> [#uses=2]
11 define i32 @unroll() nounwind {
12 ; CHECK-LABEL: @unroll(
14 ; CHECK-NEXT: store volatile i32 1000, ptr @v1, align 4
15 ; CHECK-NEXT: store volatile i32 1001, ptr @v1, align 4
16 ; CHECK-NEXT: store volatile i32 1001, ptr @v1, align 4
17 ; CHECK-NEXT: ret i32 0
23 %0 = icmp eq i32 %i.0, 0 ; <i1> [#uses=1]
24 br i1 %0, label %bb1, label %bb2
27 store volatile i32 1000, ptr @v1, align 4
31 store volatile i32 1001, ptr @v1, align 4
34 bb3: ; preds = %bb2, %bb1
35 %1 = add i32 %i.0, 1 ; <i32> [#uses=1]
38 bb4: ; preds = %bb3, %entry
39 %i.0 = phi i32 [ 0, %entry ], [ %1, %bb3 ] ; <i32> [#uses=3]
40 %2 = icmp sgt i32 %i.0, 2 ; <i1> [#uses=1]
41 br i1 %2, label %bb5, label %bb