1; RUN: llc -asm-verbose=true < %s | FileCheck %s 2 3; MachineLICM should check dominance before hoisting instructions. 4; only the load of a0 is guaranteed to execute, so only it can be hoisted. 5; CHECK: movb (%rdi), [[a0reg:%[a-z0-9]+]] 6; CHECK: ## %for.body.i 7; CHECK: testb [[a0reg]], [[a0reg]] 8; CHECK: ## in Loop: 9; CHECK: cmpb $1, ({{%[a-z0-9]+}}) 10; CHECK: cmpb $2, ({{%[a-z0-9]+}}) 11; CHECK: cmpb $3, ({{%[a-z0-9]+}}) 12 13target 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" 14target triple = "x86_64-apple-macosx10.7.2" 15 16define void @CMSColorWorldCreateParametricData( 17 i8* dereferenceable(1) %a0, 18 i8* dereferenceable(1) %a1, 19 i8* dereferenceable(1) %a2, 20 i8* dereferenceable(1) %a3, 21 i64 %count) nounwind uwtable optsize ssp readonly { 22entry: 23 br label %for.body.i 24 25for.body.i: 26 %i = phi i64 [0, %entry], [%i.inc, %for.inc.i] 27 %0 = load i8, i8* %a0, !invariant.load !0 28 %cond0 = icmp eq i8 %0, 0 29 br i1 %cond0, label %for.inc.i, label %if.then26.i 30 31if.then26.i: 32 %1 = load i8, i8* %a1, !invariant.load !0 33 %cond1 = icmp eq i8 %1, 1 34 br i1 %cond1, label %if.else.i.i, label %lor.lhs.false.i.i 35 36if.else.i.i: 37 %2 = load i8, i8* %a2, !invariant.load !0 38 %cond2 = icmp eq i8 %2, 2 39 br i1 %cond2, label %lor.lhs.false.i.i, label %for.inc.i 40 41lor.lhs.false.i.i: 42 %3 = load i8, i8* %a3, !invariant.load !0 43 %cond3 = icmp eq i8 %3, 3 44 br i1 %cond3, label %for.inc.i, label %if.end28.i 45 46for.inc.i: 47 %i.inc = add nsw i64 %i, 1 48 %cmp17.i = icmp ult i64 %i.inc, %count 49 br i1 %cmp17.i, label %for.body.i, label %if.end28.i 50 51if.end28.i: 52 ret void 53} 54 55!0 = !{} 56