NVPTX: "LLVM ERROR: Cannot select" when translating num::from_str_radix

d70f6fe
Opened by Jorge Aparicio at 2023-04-05 17:38:48

STR

$ rustc libcore/lib.rs
LLVM ERROR: Cannot select: 0x7f1356ad1170: i64,ch,glue = NVPTXISD::LoadParam<LDST0[<unknown>](align=8)> 0x7f13567aa6c0:1, Constant:i32<1>, Constant:i32<1454182880>, 0x7f13567aa6c0:2
  0x7f13567aac00: i32 = Constant<1>
  0x7f1356ad18e0: i32 = Constant<1454182880>
  0x7f13567aa6c0: i64,ch,glue = NVPTXISD::LoadParam<LDST16[<unknown>](align=8)> 0x7f1356420650, Constant:i32<1>, Constant:i32<0>, 0x7f1356420650:1
    0x7f13567aac00: i32 = Constant<1>
    0x7f134764fba0: i32 = Constant<0>
    0x7f1356420650: ch,glue = NVPTXISD::CallArgEnd 0x7f13546d9620, Constant:i32<1>, 0x7f13546d9620:1
      0x7f13567aac00: i32 = Constant<1>
      0x7f13546d9620: ch,glue = NVPTXISD::LastCallArg 0x7f13567aa5e0, Constant:i32<1>, Constant:i32<0>, 0x7f13567aa5e0:1
        0x7f13567aac00: i32 = Constant<1>
        0x7f134764fba0: i32 = Constant<0>
        0x7f13567aa5e0: ch,glue = NVPTXISD::CallArgBegin 0x7f1356ad1aa0, 0x7f1356ad1aa0:1
          0x7f1356ad1aa0: ch,glue = NVPTXISD::CallVoid 0x7f1356ad1a30, 0x7f13546d9460, 0x7f1356ad1a30:1
            0x7f13546d9460: i64 = NVPTXISD::Wrapper TargetGlobalAddress:i64<i128 (i32)* @"_ZN54_$LT$u128$u20$as$u20$core..num..FromStrRadixHelper$GT$8from_u3217h2e1aa7ebab2ba02cE"> 0
              0x7f13549f5900: i64 = TargetGlobalAddress<i128 (i32)* @"_ZN54_$LT$u128$u20$as$u20$core..num..FromStrRadixHelper$GT$8from_u3217h2e1aa7ebab2ba02cE"> 0
            0x7f1356ad1a30: ch,glue = NVPTXISD::PrintCallUni 0x7f134764ff20, Constant:i32<1>, 0x7f134764ff20:1
              0x7f13567aac00: i32 = Constant<1>
              0x7f134764ff20: ch,glue = NVPTXISD::DeclareRet 0x7f1356273c20, Constant:i32<1>, Constant:i32<128>, Constant:i32<0>, 0x7f1356273c20:1
                0x7f13567aac00: i32 = Constant<1>
                0x7f1356ad11e0: i32 = Constant<128>
                0x7f134764fba0: i32 = Constant<0>
                0x7f1356273c20: ch,glue = NVPTXISD::StoreParam<LDST4[<unknown>]> 0x7f13568bf2e0, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, 0x7f13568bf2e0:1
                  0x7f134764fba0: i32 = Constant<0>
                  0x7f134764fba0: i32 = Constant<0>
                  0x7f134764fba0: i32 = Constant<0>
                  0x7f13568bf2e0: ch,glue = NVPTXISD::DeclareScalarParam 0x7f13568beda0, Constant:i32<0>,Constant:i32<32>, Constant:i32<0>, 0x7f13568beda0:1




In function: _ZN4core3num14from_str_radix17h4c0c1d66bbd93620E

NOTE: Requires turning off LLVM assertions to avoid #38824

Meta

$ rustc --version
rustc 1.18.0-dev (50c186419 2017-04-06)
  1. from_str_radix ... sounds like an i128 related issue as well.

    est31 at 2017-04-07 17:37:06

  2. Possible, but the instruction that it can't select seems to be an i64 load, so I wouldn't bet on it.

    Edit: @est31 pointed out to me on IRC that this occurs in the i128 expansion of the macro (it references <u128 as FromRadixHelper>::from_u32), so it is in fact i128 related.

    Hanna Kruppe at 2017-04-07 18:26:40