Skip to content

[AArch64][GlobalISel] Crash when selecting G_CONSTANT_FOLD_BARRIER  #64697

@uaex

Description

@uaex

Assertion failed: (canReplaceReg(DstReg, SrcReg, MRI) && "Must be able to replace dst with src!"), function runOnMachineFunction, file InstructionSelect.cpp, line 190.

DstReg MI:
%11:gpr(s64) = G_CONSTANT_FOLD_BARRIER %7:gpr64sp, debug-location !516; <compiler-generated>:0

SrcReg MI:
%7:gpr64sp(s64) = G_CONSTANT i64 -3458764513820540911

test code:

; Function Attrs: norecurse nounwind willreturn memory(none)
define hidden swiftcc { i64, ptr } @"foobar"(i8 %0) local_unnamed_addr #5 !dbg !336 {
  call void @llvm.dbg.value(metadata i8 %0, metadata !343, metadata !DIExpression()), !dbg !345
  %2 = zext i8 %0 to i32, !dbg !346
  switch i32 %2, label %3 [
    i32 0, label %16
    i32 1, label %4
    i32 2, label %5
    i32 3, label %6
    i32 4, label %7
    i32 5, label %8
    i32 6, label %9
    i32 7, label %10
    i32 8, label %11
    i32 9, label %12
    i32 10, label %13
    i32 11, label %14
    i32 12, label %15
  ], !dbg !346

3:                                                ; preds = %1
  unreachable, !dbg !346

4:                                                ; preds = %1
  br label %16, !dbg !348

5:                                                ; preds = %1
  %const2 = bitcast i64 -3458764513820540911 to i64, !dbg !345
  %const_mat3 = add i64 %const2, 8, !dbg !345
  br label %16, !dbg !351

6:                                                ; preds = %1
  %const1 = bitcast i64 -3458764513820540911 to i64, !dbg !345
  br label %16, !dbg !362

7:                                                ; preds = %1
  br label %16, !dbg !366

8:                                                ; preds = %1
  br label %16, !dbg !369

9:                                                ; preds = %1
  %const = bitcast i64 -3458764513820540911 to i64, !dbg !345
  %const_mat = add i64 %const, 7, !dbg !345
  br label %16, !dbg !372

10:                                               ; preds = %1
  br label %16, !dbg !376

11:                                               ; preds = %1
  br label %16, !dbg !379

12:                                               ; preds = %1
  br label %16, !dbg !382

13:                                               ; preds = %1
  br label %16, !dbg !385

14:                                               ; preds = %1
  br label %16, !dbg !388

15:                                               ; preds = %1
  br label %16, !dbg !391

16:                                               ; preds = %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5, %4, %1
  %17 = phi i64 [ 6878243912809013616, %15 ], [ 7019813714336442742, %14 ], [ 8100135556092158324, %13 ], [ 8100135556075381108, %12 ], [ 111516182736740, %11 ], [ 7016438260649258852, %10 ], [ %const_mat, %9 ], [ 1684366694, %8 ], [ 1852989797, %7 ], [ %const1, %6 ], [ %const_mat3, %5 ], [ 114776264237420, %4 ], [ 32770348699510116, %1 ], !dbg !345
  %18 = phi ptr [ inttoptr (i64 -1296925215037626269 to ptr), %15 ], [ inttoptr (i64 -1585267068834388633 to ptr), %14 ], [ inttoptr (i64 -1729382256910270464 to ptr), %13 ], [ inttoptr (i64 -1729382256910270464 to ptr), %12 ], [ inttoptr (i64 -1873497444986126336 to ptr), %11 ], [ inttoptr (i64 -1190792630155774877 to ptr), %10 ], [ inttoptr (i64 or (i64 sub (i64 ptrtoint (ptr @17 to i64), i64 32), i64 -9223372036854775808) to ptr), %9 ], [ inttoptr (i64 -2017612633061982208 to ptr), %8 ], [ inttoptr (i64 -2017612633061982208 to ptr), %7 ], [ inttoptr (i64 or (i64 sub (i64 ptrtoint (ptr @18 to i64), i64 32), i64 -9223372036854775808) to ptr), %6 ], [ inttoptr (i64 or (i64 sub (i64 ptrtoint (ptr @19 to i64), i64 32), i64 -9223372036854775808) to ptr), %5 ], [ inttoptr (i64 -1873497444986126336 to ptr), %4 ], [ inttoptr (i64 -1801439850948198400 to ptr), %1 ], !dbg !345
  %19 = insertvalue { i64, ptr } undef, i64 %17, 0, !dbg !345
  %20 = insertvalue { i64, ptr } %19, ptr %18, 1, !dbg !345
  ret { i64, ptr } %20, !dbg !345
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions