Codegen regression caused by r207337

Benjamin Kramer benny.kra at gmail.com
Tue Apr 29 02:45:09 PDT 2014


On 29.04.2014, at 10:54, Richard Barton <richard.barton at arm.com> wrote:

> Hi Craig
> 
> Your refactoring change to the AArch64 backend at r207337 seems to have
> caused an internal fault in the instruction selector.
> 
>> clang -c -O2 ~/scratch/besttry.c -target aarch64
> fatal error: error in backend: Cannot select: 0x43e83d0: v2i64 = mulhs
> 0x43f1320, 0x43f0340
>      [ORD=5] [ID=51]
>  0x43f1320: v2i64 = add 0x43f1110, 0x43f0448 [ORD=4] [ID=47]
>    0x43f1110: v2i64 = AArch64ISD::NEON_VDUP 0x43e7b90 [ORD=3] [ID=35]
>      0x43e7b90: i64,ch = CopyFromReg 0x4390e90, 0x43e7560 [ORD=2] [ID=27]
>        0x43e7560: i64 = Register %vreg0 [ID=1]
>    0x43f0448: v2i64,ch = load 0x4390e90, 0x43f1f10,
> 0x43eb8e8<LD16[ConstantPool]> [ORD=4] [ID=41]
>      0x43f1f10: i64 = AArch64ISD::WrapperSmall 0x43f3d90, 0x43e81c0,
> 0x43ecd60 [ID=34]
>        0x43f3d90: i64 = TargetConstantPool<<2 x i64> <i64 6, i64 7>> 0
> [ID=26]
>        0x43e81c0: i64 = TargetConstantPool<<2 x i64> <i64 6, i64 7>> 0
> [TF=11] [ID=25]
>        0x43ecd60: i32 = Constant<16> [ID=18]
>      0x43eb8e8: i64 = undef [ID=6]
>  0x43f0340: v2i64 = AArch64ISD::NEON_VDUP 0x43e7c98 [ID=28]
>    0x43e7c98: i64 = Constant<1166592510590327375> [ID=14]
> In function: main
> clang-3.5: error: clang frontend command failed with exit code 70 (use -v to
> see invocation)
> 
> Below is a reduced example (also attached) that produces the fault:
> 
> int errs = 0;
> int main()
> {
> #define SIZE 254L
> #define SIZE2 253L
>    unsigned char buf[SIZE];
>    int i;
>    for (i = 0; i < SIZE; ++i)
>        buf[i] = i % SIZE2;
>    if (!(buf[i] == i % SIZE2))
>        ++errs; 
> }
> 
> I can remove the fault by reducing the optimisation level or by playing with
> the values of SIZE and SIZE2 (the fault only occurs when SIZE > SIZE2)

This is my fault, I forgot to update the aarch64 backend when flipping on vectorization of
certain div/rem sequences by a constant.

r207515 should fix it.

- Ben





More information about the llvm-commits mailing list