[LLVMdev] Possible Phi Removal Pass?

Sebastian Redl sebastian.redl at getdesigned.at
Thu Nov 10 10:48:56 PST 2011


On 11/10/2011 06:08 PM, bdavis at cs.fsu.edu wrote:
> ===============================================================
> ; Post-pass
>
> entry:
>     ...
>     br label %entry.to.for.body
>
> entry.to.for.body:          ; preds = %entry
>     %indvar = add i32 0, 0
>     %j.02 = add i32 10, 0
>     br label %for.body
>
> for.body:                   ; preds = %entry.to.for.body,
> %sw.epilog.to.for.body
>     ; both phi instructions removed
>     ...
>
> sw.epilog:                  ; preds = ...
>     ...
>     br i1 %exitcond, label %for.end, label %sw.epilog.to.for.body
>
> sw.epilog.to.for.body:      ; preds = %sw.epilog
>     %indvar = add i32 %indvar.next, 0
>     %j.02 = add i32 %j.2, 0
>     br label %for.body
>
> ; End post-pass code example
> ===============================================================
>
> Is there some error in this that I may be missing, or does this seem
> to be a reasonable pass to write?
>
This isn't SSA form anymore. You have two assignments to %indvar and %j.02.

Sebastian



More information about the llvm-dev mailing list