llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Crash in x86 instruction selection from short program

Open llvmbot opened this issue 13 years ago • 2 comments

Bugzilla Link 16807
Resolution FIXED
Resolved on Oct 15, 2013 15:06
Version trunk
OS All
Attachments test case
Reporter LLVM Bugzilla Contributor
CC @dbabokin,@darkbuck

Extended Description

With top-of-tree, the attached test case hits the following bug in instruction selection.

% llc -o - bugpoint-reduced-simplified.ll .section __TEXT,__text,regular,pure_instructions LLVM ERROR: Cannot select: 0x7ff18103de10: v16i16 = X86ISD::VSRAI 0x7ff181044210, 0x7ff18103da10 [ORD=4] [ID=49] 0x7ff181044210: v16i16 = insert_subvector 0x7ff181044110, 0x7ff18103ce10, 0x7ff18103d410 [ORD=4] [ID=48] 0x7ff181044110: v16i16 = insert_subvector 0x7ff181042f10, 0x7ff18103e810, 0x7ff18103ad10 [ORD=4] [ID=47] 0x7ff181042f10: v16i16 = undef [ID=31] 0x7ff18103e810: v8i16 = add 0x7ff18103eb10, 0x7ff18103e310 [ORD=4] [ID=46] 0x7ff18103eb10: v8i16 = bitcast 0x7ff18103b010 [ORD=3] [ID=39] 0x7ff18103b010: v2i64,ch = load 0x7ff180c11d50, 0x7ff181044510, 0x7ff18103b810<LD16[ConstantPool]> [ORD=3] [ID=37] 0x7ff181044510: i64 = X86ISD::WrapperRIP 0x7ff181044410 [ID=35] 0x7ff181044410: i64 = TargetConstantPool<<8 x i16> <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>> 0 [ID=32] 0x7ff18103b810: i64 = undef [ID=1] 0x7ff18103e310: v8i16 = extract_subvector 0x7ff18103d210, 0x7ff18103ad10 [ORD=4] [ID=44] 0x7ff18103d210: v16i16 = X86ISD::VSRLI 0x7ff18103cd10, 0x7ff18103ca10 [ORD=4] [ID=42] 0x7ff18103cd10: v16i16 = X86ISD::VSRAI 0x7ff181044610, 0x7ff18103ca10 [ORD=4] [ID=41] 0x7ff181044610: v16i16 = bitcast 0x7ff18103b110 [ORD=3] [ID=40] 0x7ff18103b110: v4i64,ch = load 0x7ff180c11d50, 0x7ff181044710, 0x7ff18103b810<LD32[ConstantPool]> [ORD=3] [ID=38] 0x7ff181044710: i64 = X86ISD::WrapperRIP 0x7ff181044310 [ID=36]

              0x7ff18103b810: i64 = undef [ID=1]
          0x7ff18103ca10: i32 = Constant<15> [ID=20]
        0x7ff18103ca10: i32 = Constant<15> [ID=20]
      0x7ff18103ad10: i64 = Constant<0> [ID=3]
  0x7ff18103ad10: i64 = Constant<0> [ID=3]
0x7ff18103ce10: v8i16 = add 0x7ff18103eb10, 0x7ff18103e710 [ORD=4] [ID=45]
  0x7ff18103eb10: v8i16 = bitcast 0x7ff18103b010 [ORD=3] [ID=39]
    0x7ff18103b010: v2i64,ch = load 0x7ff180c11d50, 0x7ff181044510, 0x7ff18103b810<LD16[ConstantPool]> [ORD=3] [ID=37]
      0x7ff181044510: i64 = X86ISD::WrapperRIP 0x7ff181044410 [ID=35]
        0x7ff181044410: i64 = TargetConstantPool<<8 x i16> <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>> 0 [ID=32]
      0x7ff18103b810: i64 = undef [ID=1]
  0x7ff18103e710: v8i16 = extract_subvector 0x7ff18103d210, 0x7ff18103d410 [ORD=4] [ID=43]
    0x7ff18103d210: v16i16 = X86ISD::VSRLI 0x7ff18103cd10, 0x7ff18103ca10 [ORD=4] [ID=42]
      0x7ff18103cd10: v16i16 = X86ISD::VSRAI 0x7ff181044610, 0x7ff18103ca10 [ORD=4] [ID=41]
        0x7ff181044610: v16i16 = bitcast 0x7ff18103b110 [ORD=3] [ID=40]
          0x7ff18103b110: v4i64,ch = load 0x7ff180c11d50, 0x7ff181044710, 0x7ff18103b810<LD32[ConstantPool]> [ORD=3] [ID=38]
            0x7ff181044710: i64 = X86ISD::WrapperRIP 0x7ff181044310 [ID=36]
              0x7ff181044310: i64 = TargetConstantPool<<16 x i16> <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>> 0 [ID=33]
            0x7ff18103b810: i64 = undef [ID=1]
        0x7ff18103ca10: i32 = Constant<15> [ID=20]
      0x7ff18103ca10: i32 = Constant<15> [ID=20]
    0x7ff18103d410: i64 = Constant<8> [ID=12]
0x7ff18103d410: i64 = Constant<8> [ID=12]

0x7ff18103da10: i32 = Constant<1> [ID=21] In function: f_fu %

llvmbot avatar Aug 06 '13 18:08 llvmbot

fixed in r192721.

darkbuck avatar Oct 15 '13 22:10 darkbuck

I have a nice reproducer for this issue:

; ModuleID = 'a.o' target datalayout = "e-p:64:64:64-S128-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f16:16:16-f32:32:32-f64:64:64-f128:128:128-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: nounwind define void @​f_fu(<16 x i16>* %RET, <16 x i16> %bf) { allocas: %avg.i.i = sdiv <16 x i16> %bf, <i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2> store <16 x i16> %avg.i.i, <16 x i16>* %RET, align 4 ret void }

this issue is a regression between 3.2 and 3.3 versions. Also, if we change <16 x i16> to <15 x i16> or less everything will pass.

llvmbot avatar Oct 10 '13 14:10 llvmbot