FastISel may create a redundant BGTZ terminal which fallthroughes. ``` BGTZ %2:gpr32, %bb.1, implicit-def $at bb.1.bb1: ; predecessors: %bb.0 ``` The `!I->isBarrier()` check in MipsAsmPrinter::isBlockOnlyReachableByFallthrough will incorrectly not print a label, leading to a `Undefined temporary symbol ` error when we try assembling the output assembly file. See the updated `Fast-ISel/pr40325.ll` and https://github.com/rust-lang/rust/issues/108835 In addition, the `SwitchInst` condition is too conservative and prints many unneeded labels (see the updated tests). Just use the generic isBlockOnlyReachableByFallthrough, updated by commit 1995b9fead62f2f6c0ad217bd00ce3184f741fdb for SPARC, which also handles MIPS.
25 lines
658 B
LLVM
25 lines
658 B
LLVM
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
; RUN: llc -mtriple=mipsel -relocation-model=pic -O0 -mcpu=mips32 < %s | FileCheck %s
|
|
|
|
define void @test(i32 %x, ptr %p) nounwind {
|
|
; CHECK-LABEL: test:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: move $1, $4
|
|
; CHECK-NEXT: move $4, $1
|
|
; CHECK-NEXT: andi $1, $1, 1
|
|
; CHECK-NEXT: sb $1, 0($5)
|
|
; CHECK-NEXT: andi $1, $4, 1
|
|
; CHECK-NEXT: bgtz $1, $BB0_1
|
|
; CHECK-NEXT: nop
|
|
; CHECK-NEXT: $BB0_1: # %foo
|
|
; CHECK-NEXT: jr $ra
|
|
; CHECK-NEXT: nop
|
|
%y = and i32 %x, 1
|
|
%c = icmp eq i32 %y, 1
|
|
store i1 %c, ptr %p
|
|
br i1 %c, label %foo, label %foo
|
|
|
|
foo:
|
|
ret void
|
|
}
|