From 4e9196ebcb9d9bc715308b89f22499efd822da73 Mon Sep 17 00:00:00 2001 From: Nick Desaulniers Date: Fri, 19 Jul 2019 18:18:02 +0000 Subject: [PATCH] Revert "Use the MachineBasicBlock symbol for a callbr target" This reverts commit r366523/ccbffefccaff42b0d094c9ef0f49fc3e8c8456ea. Two regressions were immediately reported: - https://github.com/ClangBuiltLinux/linux/issues/614 - https://github.com/ClangBuiltLinux/linux/issues/615 Reported-by: nathanchance llvm-svn: 366600 --- llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp | 9 ++------- llvm/test/CodeGen/X86/callbr-asm-obj-file.ll | 19 ------------------- llvm/test/CodeGen/X86/callbr-asm.ll | 16 ++++++++-------- 3 files changed, 10 insertions(+), 34 deletions(-) delete mode 100644 llvm/test/CodeGen/X86/callbr-asm-obj-file.ll diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp index 59d3b7c..7721e99 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp @@ -430,13 +430,8 @@ static void EmitGCCInlineAsmStr(const char *AsmStr, const MachineInstr *MI, if (Modifier[0] == 'l') { // Labels are target independent. if (MI->getOperand(OpNo).isBlockAddress()) { const BlockAddress *BA = MI->getOperand(OpNo).getBlockAddress(); - const BasicBlock *BB = BA->getBasicBlock(); - const MachineFunction *MF = MI->getParent()->getParent(); - for (const MachineBasicBlock &MBB : *MF) - if (BB == MBB.getBasicBlock()) { - MBB.getSymbol()->print(OS, AP->MAI); - break; - } + MCSymbol *Sym = AP->GetBlockAddressSymbol(BA); + Sym->print(OS, AP->MAI); } else if (MI->getOperand(OpNo).isMBB()) { const MCSymbol *Sym = MI->getOperand(OpNo).getMBB()->getSymbol(); Sym->print(OS, AP->MAI); diff --git a/llvm/test/CodeGen/X86/callbr-asm-obj-file.ll b/llvm/test/CodeGen/X86/callbr-asm-obj-file.ll deleted file mode 100644 index d526045..0000000 --- a/llvm/test/CodeGen/X86/callbr-asm-obj-file.ll +++ /dev/null @@ -1,19 +0,0 @@ -; RUN: llc < %s -mtriple=x86_64-linux-gnu -filetype=obj -o - \ -; RUN: | llvm-objdump -triple x86_64-linux-gnu -d - \ -; RUN: | FileCheck %s - -; CHECK: 0000000000000000 test1: -; CHECK-NEXT: 0: 74 00 je 0 -; CHECK-NEXT: 2: c3 retq - -define void @test1() { -entry: - callbr void asm sideeffect "je ${0:l}", "X,~{dirflag},~{fpsr},~{flags}"(i8* blockaddress(@test1, %a.b.normal.jump)) - to label %asm.fallthrough [label %a.b.normal.jump] - -asm.fallthrough: - ret void - -a.b.normal.jump: - ret void -} diff --git a/llvm/test/CodeGen/X86/callbr-asm.ll b/llvm/test/CodeGen/X86/callbr-asm.ll index 35dd480..48a80ae 100644 --- a/llvm/test/CodeGen/X86/callbr-asm.ll +++ b/llvm/test/CodeGen/X86/callbr-asm.ll @@ -12,7 +12,7 @@ define i32 @test1(i32 %a) { ; CHECK-NEXT: addl $4, %eax ; CHECK-NEXT: #APP ; CHECK-NEXT: xorl %eax, %eax -; CHECK-NEXT: jmp .LBB0_2 +; CHECK-NEXT: jmp .Ltmp00 ; CHECK-NEXT: #NO_APP ; CHECK-NEXT: .LBB0_1: # %normal ; CHECK-NEXT: xorl %eax, %eax @@ -87,17 +87,17 @@ define dso_local i32 @test3(i32 %a) { ; CHECK-NEXT: # Parent Loop BB2_3 Depth=3 ; CHECK-NEXT: # => This Inner Loop Header: Depth=4 ; CHECK-NEXT: #APP -; CHECK-NEXT: jmp .LBB2_1 -; CHECK-NEXT: jmp .LBB2_2 -; CHECK-NEXT: jmp .LBB2_3 +; CHECK-NEXT: jmp .Ltmp10 +; CHECK-NEXT: jmp .Ltmp20 +; CHECK-NEXT: jmp .Ltmp30 ; CHECK-NEXT: #NO_APP ; CHECK-NEXT: .LBB2_5: # %normal0 ; CHECK-NEXT: # in Loop: Header=BB2_4 Depth=4 ; CHECK-NEXT: #APP -; CHECK-NEXT: jmp .LBB2_1 -; CHECK-NEXT: jmp .LBB2_2 -; CHECK-NEXT: jmp .LBB2_3 -; CHECK-NEXT: jmp .LBB2_4 +; CHECK-NEXT: jmp .Ltmp10 +; CHECK-NEXT: jmp .Ltmp20 +; CHECK-NEXT: jmp .Ltmp30 +; CHECK-NEXT: jmp .Ltmp40 ; CHECK-NEXT: #NO_APP ; CHECK-NEXT: .LBB2_6: # %normal1 ; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax -- 2.7.4