Skip to content

[Mips] When emit instruction, ignore JUMP_TABLE_DEBUG_INFO #139830

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -694,8 +694,10 @@ bool MipsDelaySlotFiller::searchRange(MachineBasicBlock &MBB, IterTy Begin,
IterTy CurrI = I;
++I;
LLVM_DEBUG(dbgs() << DEBUG_TYPE ": checking instruction: "; CurrI->dump());
// skip debug value
if (CurrI->isDebugInstr()) {
// Skip debug value.
// Instruction TargetOpcode::JUMP_TABLE_DEBUG_INFO is only used to note
// jump table debug info, we did not need to emit it.
if (CurrI->isDebugInstr() || CurrI->isJumpTableDebugInfo()) {
LLVM_DEBUG(dbgs() << DEBUG_TYPE ": ignoring debug instruction: ";
CurrI->dump());
continue;
Expand Down
58 changes: 58 additions & 0 deletions llvm/test/CodeGen/Mips/jumptable_labels.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
; RUN: llc -mtriple=mips-elf < %s | FileCheck %s -check-prefix=O32
; RUN: llc -mtriple=mips64-elf -target-abi=n32 < %s | FileCheck %s -check-prefix=N32
; RUN: llc -mtriple=mips64-elf < %s | FileCheck %s -check-prefix=N64
; RUN: llc -mtriple=mipsel-windows-gnu < %s | FileCheck %s -check-prefix=MIPSEL

; We only use the '$' prefix on O32. The others use the ELF convention.
; O32: $JTI0_0
Expand All @@ -12,6 +13,63 @@
; N32: .LBB0_2:
; N64: .LBB0_2:

; MIPSEL-LABEL: _Z3fooi:
; MIPSEL: # %bb.0: # %entry
; MIPSEL-NEXT: addiu $sp, $sp, -16
; MIPSEL-NEXT: sltiu $1, $4, 7
; MIPSEL-NEXT: beqz $1, .LBB0_6
; MIPSEL-NEXT: sw $4, 4($sp)
; MIPSEL-NEXT: # %bb.1: # %entry
; MIPSEL-NEXT: sll $1, $4, 2
; MIPSEL-NEXT: lui $2, %hi($JTI0_0)
; MIPSEL-NEXT: addu $1, $1, $2
; MIPSEL-NEXT: lw $1, %lo($JTI0_0)($1)
; MIPSEL-NEXT: jr $1
; MIPSEL-NEXT: nop
; MIPSEL-NEXT: .LBB0_2: # %sw.bb
; MIPSEL-NEXT: lui $1, %hi($.str)
; MIPSEL-NEXT: addiu $1, $1, %lo($.str)
; MIPSEL-NEXT: j .LBB0_10
; MIPSEL-NEXT: sw $1, 8($sp)
; MIPSEL-NEXT: .LBB0_3: # %sw.bb4
; MIPSEL-NEXT: lui $1, %hi($.str.4)
; MIPSEL-NEXT: addiu $1, $1, %lo($.str.4)
; MIPSEL-NEXT: j .LBB0_10
; MIPSEL-NEXT: sw $1, 8($sp)
; MIPSEL-NEXT: .LBB0_4: # %sw.bb2
; MIPSEL-NEXT: lui $1, %hi($.str.2)
; MIPSEL-NEXT: addiu $1, $1, %lo($.str.2)
; MIPSEL-NEXT: j .LBB0_10
; MIPSEL-NEXT: sw $1, 8($sp)
; MIPSEL-NEXT: .LBB0_5: # %sw.bb3
; MIPSEL-NEXT: lui $1, %hi($.str.3)
; MIPSEL-NEXT: addiu $1, $1, %lo($.str.3)
; MIPSEL-NEXT: j .LBB0_10
; MIPSEL-NEXT: sw $1, 8($sp)
; MIPSEL-NEXT: .LBB0_6: # %sw.epilog
; MIPSEL-NEXT: lui $1, %hi($.str.7)
; MIPSEL-NEXT: addiu $1, $1, %lo($.str.7)
; MIPSEL-NEXT: j .LBB0_10
; MIPSEL-NEXT: sw $1, 8($sp)
; MIPSEL-NEXT: .LBB0_7: # %sw.bb1
; MIPSEL-NEXT: lui $1, %hi($.str.1)
; MIPSEL-NEXT: addiu $1, $1, %lo($.str.1)
; MIPSEL-NEXT: j .LBB0_10
; MIPSEL-NEXT: sw $1, 8($sp)
; MIPSEL-NEXT: .LBB0_8: # %sw.bb5
; MIPSEL-NEXT: lui $1, %hi($.str.5)
; MIPSEL-NEXT: addiu $1, $1, %lo($.str.5)
; MIPSEL-NEXT: j .LBB0_10
; MIPSEL-NEXT: sw $1, 8($sp)
; MIPSEL-NEXT: .LBB0_9: # %sw.bb6
; MIPSEL-NEXT: lui $1, %hi($.str.6)
; MIPSEL-NEXT: addiu $1, $1, %lo($.str.6)
; MIPSEL-NEXT: sw $1, 8($sp)
; MIPSEL-NEXT: .LBB0_10: # %return
; MIPSEL-NEXT: lw $2, 8($sp)
; MIPSEL-NEXT: jr $ra
; MIPSEL-NEXT: addiu $sp, $sp, 16

@.str = private unnamed_addr constant [2 x i8] c"A\00", align 1
@.str.1 = private unnamed_addr constant [2 x i8] c"B\00", align 1
@.str.2 = private unnamed_addr constant [2 x i8] c"C\00", align 1
Expand Down