[LLVMdev] Optimisation of select/cmp/br

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Feb 5 15:32:07 PST 2014


On 4 February 2014 23:37, Pete Calvert <prc33 at cam.ac.uk> wrote:
> Hi,
>
> Is there anyway I can coerce LLVM into performing the following
> transformation?
>
>   %1 = icmp eq i32 %flag, 1
>   %2 = select i1 %1, %foo* %data, %struct.cell_t* null
>   %3 = icmp eq %foo* %2, null
>   br i1 %3, label %failure, label %success
>

It seems something that GVN should be able to handle if expressed with
branches instead of select. Unfortunately it currently doesn't :-(

It is a long project, but one way to fix this might be to extend
(rewrite?) GVN PRE (pr13307, pr10254) and then make GVN handle selects
too (on way to fix pr13590 and hopefully your example).

Cheers,
Rafael



More information about the llvm-dev mailing list