[LLVMdev] Transforming wide integer computations back to vector computations

Eli Friedman eli.friedman at gmail.com
Mon Jan 2 10:14:15 PST 2012


On Mon, Jan 2, 2012 at 9:12 AM, Matt Pharr <matt.pharr at gmail.com> wrote:
> It seems that one of the optimization passes (it seems to be SROA) sometimes transforms computations on vectors of ints to computations on wide integer types; for example, I'm seeing code like the following after optimizations(*):
>
>  %0 = bitcast <16 x i8> %float2uint to i128
>  %1 = shl i128 %0, 8
>  %ins = or i128 %1, 255
>  %2 = bitcast i128 %ins to <16 x i8>
>
> The back end I'm trying to get this code to go through (a hacked up version of the LLVM C backend(**)) doesn't support wide integer types, but is fine with the original vectors of integers; I'm wondering if there's a straightforward way to avoid having these computations on wide integer types generated in the first place

The simplest workaround is to skip running scalarrepl, and just use
the mem2reg pass instead.  IIRC, no other pass generates large
integers like that at the moment.  (The idea is generally that the
large integers get eliminated by instcombine, but as you're seeing
that isn't guaranteed.)

-Eli




More information about the llvm-dev mailing list