Issue 79718
Summary [LoongArch] Assertion `isReg() && "This is not a register operand!"'
Labels new issue
Assignees
Reporter DianQK
    I tried this code with `llc --mtriple=loongarch64`

```llvm
define void @foo(i1 %0) {
  br label %2

2:                                                ; preds = %32, %1
  %3 = phi i64 [ 0, %1 ], [ %27, %32 ]
  %4 = phi i64 [ 0, %1 ], [ %28, %32 ]
  %5 = phi i64 [ undef, %1 ], [ %30, %32 ]
  br label %6

6:                                                ; preds = %26, %2
  %7 = phi i64 [ %27, %26 ], [ %3, %2 ]
  %8 = phi i64 [ %28, %26 ], [ %4, %2 ]
  %9 = phi i64 [ 0, %26 ], [ %3, %2 ]
  %10 = phi i64 [ %29, %26 ], [ %4, %2 ]
  %11 = phi i64 [ %30, %26 ], [ %5, %2 ]
  br i1 %0, label %20, label %12

12: ; preds = %6
  br i1 %0, label %13, label %18

13: ; preds = %12
  br i1 %0, label %16, label %14

14:                                               ; preds = %13
  %15 = call { i64, i64 } null(i8 0, ptr null, i64 0)
  br label %16

16:                                               ; preds = %14, %13
  %17 = or i64 1, %10
  br label %20

18: ; preds = %12
  br i1 %0, label %23, label %19

19:                                               ; preds = %18
  br label %23

20: ; preds = %16, %6
  %21 = phi i64 [ %8, %6 ], [ %17, %16 ]
  %22 = phi i64 [ %10, %6 ], [ %17, %16 ]
  store i8 0, ptr null, align 1
  br label %26

23:                                               ; preds = %19, %18
  %24 = phi i64 [ 1, %19 ], [ 0, %18 ]
  %25 = phi i64 [ %11, %19 ], [ 0, %18 ]
  store i64 0, ptr null, align 8
  br label %26

26:                                               ; preds = %23, %20
  %27 = phi i64 [ %25, %23 ], [ %7, %20 ]
  %28 = phi i64 [ %24, %23 ], [ %21, %20 ]
  %29 = phi i64 [ %24, %23 ], [ %22, %20 ]
  %30 = phi i64 [ %25, %23 ], [ %11, %20 ]
  %31 = getelementptr i8, ptr null, i64 %9
  br i1 %0, label %6, label %32

32: ; preds = %26
  call void null(ptr null, ptr null, i64 0, ptr %31, i64 0)
  br label %2
}
```

I got a segmentation fault.
If assertion is turned on, I can get `isReg() && "This is not a register operand!"' failed`.

GodBolt: https://llvm.godbolt.org/z/va3YPK44e
From: https://github.com/rust-lang/rust/pull/120268

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to