Kai Luo 6615581526
[PowerPC] Make verifier happy when lowering llvm.trap (#77266)
`llvm.trap` is lowered to `PPC::TRAP` and `PPC::TRAP` is set as
terminator. Verifier complains about terminator should not lie in the
middle of an MBB. See #77095.

Fix it by removing `isTerminator` and `isBarrier` and then set `isTrap`
which was introduced by https://reviews.llvm.org/D48836# and is being
used by X86 and AArch64.

`PPC::TRAP` is not a hardware memory barrier and `llvm.trap` doesn't
indicate a memory barrier either.
2024-01-10 09:23:30 +08:00

17 lines
490 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-- < %s | FileCheck %s
; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-- -ppc-opt-conditional-trap \
; RUN: < %s | FileCheck %s
define i32 @test() {
; CHECK-LABEL: test:
; CHECK: # %bb.0:
; CHECK-NEXT: li 3, 0
; CHECK-NEXT: trap
; CHECK-NEXT: blr
call void @llvm.trap()
ret i32 0
}
declare void @llvm.trap()