From ef8a810cd7a55ebd786c58e1e5001d920372a983 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 27 Nov 2013 06:53:13 +0000 Subject: [PATCH] Cleanup and test X86AsmPrinter::printPCRelImm. It is only used for asm printing. On X86 we put basic block addresses on register before passing them to inline asm, so the MO_MachineBasicBlock case was dead. MO_ExternalSymbol was dead since any symbol being passed to inline asm is represented as MO_GlobalAddress. The MO_GlobalAddress and MO_Register cases were not tested. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195824 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86AsmPrinter.cpp | 4 ---- test/CodeGen/X86/inline-asm.ll | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/Target/X86/X86AsmPrinter.cpp b/lib/Target/X86/X86AsmPrinter.cpp index 12584411509..8d8b3bd174a 100644 --- a/lib/Target/X86/X86AsmPrinter.cpp +++ b/lib/Target/X86/X86AsmPrinter.cpp @@ -220,11 +220,7 @@ void X86AsmPrinter::printPCRelImm(const MachineInstr *MI, unsigned OpNo, case MachineOperand::MO_Immediate: O << MO.getImm(); return; - case MachineOperand::MO_MachineBasicBlock: - O << *MO.getMBB()->getSymbol(); - return; case MachineOperand::MO_GlobalAddress: - case MachineOperand::MO_ExternalSymbol: printSymbolOperand(MO, O); return; } diff --git a/test/CodeGen/X86/inline-asm.ll b/test/CodeGen/X86/inline-asm.ll index d201ebdc85d..f12c2600fff 100644 --- a/test/CodeGen/X86/inline-asm.ll +++ b/test/CodeGen/X86/inline-asm.ll @@ -59,3 +59,18 @@ entry: %asm = tail call i32 asm sideeffect "", "={ax},i,~{eax},~{flags},~{rax}"(i64 61) nounwind ret i32 %asm } + +@test8_v = global i32 42 + +define void @test8() { + call void asm sideeffect "${0:P}", "i"( i32* @test8_v ) + ret void +} + +define void @test9() { + call void asm sideeffect "${0:P}", "X"( i8* blockaddress(@test9, %bb) ) + br label %bb + +bb: + ret void +}