[llvm-commits] [llvm] r42075 - in /llvm/trunk: lib/Transforms/Scalar/LICM.cpp test/Transforms/LICM/2007-09-17-PrompteValue.ll

Devang Patel dpatel at apple.com
Tue Sep 18 15:59:45 PDT 2007


On Sep 18, 2007, at 3:38 PM, Dan Gohman wrote:

> Ok, so let's tweak the testcase again:
>
> define i32 @foo(%struct.decision* %p, %struct.decision* %q) {
> entry:
>       br label %blah.i
>
> blah.i:                ; preds = %cond_true.i, %entry
>       %tmp3.i = icmp eq %struct.decision* null, %q          ; <i1>  
> [#uses=1]
>       br i1 %tmp3.i, label %clear_modes.exit, label %cond_true.i
>
> cond_true.i:           ; preds = %blah.i
>       %tmp1.i = getelementptr %struct.decision* %p, i32 0, i32  
> 0            ; <i8*> [#uses=1]
>       store i8 0, i8* %tmp1.i
>       br label %blah.i
>
> clear_modes.exit:              ; preds = %blah.i
>       call void @exit( i32 0 )
>       unreachable
> }
>
> declare void @exit(i32)
>
>
> It's no longer possible for any part of the optimizer to prove the  
> loop
> is dead. LICM is still putting a load of %tmp1.i in the entry block  
> for
> this test, and that's unsafe.

Exactly, that's what I meant to say when I said "when loop  
conditionals are runtime dependent". To ensure safety in  
PromoteValuesInLoop(), one needs to prove that basic-block is executed  
at least once. The question is how ?
-
Devang



More information about the llvm-commits mailing list