Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Build fails with X86 backend enabled #56

@glaubitz

Description

@glaubitz

Building M680x0-llvm with ```-DLLVM_TARGETS_TO_BUILD="X86;M680x0" fails with:

/local_scratch/glaubitz/M680x0-llvm/lib/Target/X86/X86CondBrFolding.cpp: In member function ‘void {anonymous}::X86CondBrFolding::replaceBrDest(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*, llvm::MachineBasicBlock*)’:
/local_scratch/glaubitz/M680x0-llvm/lib/Target/X86/X86CondBrFolding.cpp:231:51: error: call of overloaded ‘findDebugLoc(llvm::MachineInstr*&)’ is ambiguous
         BuildMI(*MBB, BrMI, MBB->findDebugLoc(BrMI), TII->get(JNCC))
                                                   ^
In file included from /local_scratch/glaubitz/M680x0-llvm/include/llvm/CodeGen/TargetRegisterInfo.h:23,
                 from /local_scratch/glaubitz/M680x0-llvm/lib/Target/X86/X86RegisterInfo.h:17,
                 from /local_scratch/glaubitz/M680x0-llvm/lib/Target/X86/X86InstrInfo.h:19,
                 from /local_scratch/glaubitz/M680x0-llvm/lib/Target/X86/X86CondBrFolding.cpp:47:
/local_scratch/glaubitz/M680x0-llvm/include/llvm/CodeGen/MachineBasicBlock.h:729:12: note: candidate: ‘llvm::DebugLoc llvm::MachineBasicBlock::findDebugLoc(llvm::MachineBasicBlock::iterator)’
   DebugLoc findDebugLoc(iterator MBBI) {
            ^~~~~~~~~~~~
/local_scratch/glaubitz/M680x0-llvm/include/llvm/CodeGen/MachineBasicBlock.h:733:12: note: candidate: ‘llvm::DebugLoc llvm::MachineBasicBlock::findDebugLoc(llvm::MachineBasicBlock::reverse_iterator)’
   DebugLoc findDebugLoc(reverse_iterator MBBI) {
            ^~~~~~~~~~~~
/local_scratch/glaubitz/M680x0-llvm/lib/Target/X86/X86CondBrFolding.cpp: In member function ‘void {anonymous}::X86CondBrFolding::fixupModifiedCond(llvm::MachineBasicBlock*)’:
/local_scratch/glaubitz/M680x0-llvm/lib/Target/X86/X86CondBrFolding.cpp:257:71: error: call of overloaded ‘findDebugLoc(llvm::MachineInstr*&)’ is ambiguous
   MachineInstrBuilder MIB = BuildMI(*MBB, BrMI, MBB->findDebugLoc(BrMI),
                                                                       ^
In file included from /local_scratch/glaubitz/M680x0-llvm/include/llvm/CodeGen/TargetRegisterInfo.h:23,
                 from /local_scratch/glaubitz/M680x0-llvm/lib/Target/X86/X86RegisterInfo.h:17,
                 from /local_scratch/glaubitz/M680x0-llvm/lib/Target/X86/X86InstrInfo.h:19,
                 from /local_scratch/glaubitz/M680x0-llvm/lib/Target/X86/X86CondBrFolding.cpp:47:
/local_scratch/glaubitz/M680x0-llvm/include/llvm/CodeGen/MachineBasicBlock.h:729:12: note: candidate: ‘llvm::DebugLoc llvm::MachineBasicBlock::findDebugLoc(llvm::MachineBasicBlock::iterator)’
   DebugLoc findDebugLoc(iterator MBBI) {
            ^~~~~~~~~~~~
/local_scratch/glaubitz/M680x0-llvm/include/llvm/CodeGen/MachineBasicBlock.h:733:12: note: candidate: ‘llvm::DebugLoc llvm::MachineBasicBlock::findDebugLoc(llvm::MachineBasicBlock::reverse_iterator)’
   DebugLoc findDebugLoc(reverse_iterator MBBI) {
            ^~~~~~~~~~~~

This is fixed by the following trivial patch:

From 755ca2a218341942720c87659830cb105c8478f3 Mon Sep 17 00:00:00 2001
From: John Paul Adrian Glaubitz <[email protected]>
Date: Tue, 22 Jan 2019 01:34:58 +0100
Subject: [PATCH] [x86] Fix ambigious call to findDebugLoc()

---
 lib/Target/X86/X86CondBrFolding.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/Target/X86/X86CondBrFolding.cpp b/lib/Target/X86/X86CondBrFolding.cpp
index 7ce443c4656..6a3a4d7627b 100644
--- a/lib/Target/X86/X86CondBrFolding.cpp
+++ b/lib/Target/X86/X86CondBrFolding.cpp
@@ -228,7 +228,7 @@ void X86CondBrFolding::replaceBrDest(MachineBasicBlock *MBB,
     BrMI = MBBInfo->BrInstr;
     unsigned JNCC = GetCondBranchFromCond(MBBInfo->BranchCode);
     MachineInstrBuilder MIB =
-        BuildMI(*MBB, BrMI, MBB->findDebugLoc(BrMI), TII->get(JNCC))
+        BuildMI(*MBB, BrMI, MBB->findDebugLoc((llvm::MachineBasicBlock::iterator) BrMI), TII->get(JNCC))
             .addMBB(NewDest);
     MBBInfo->TBB = NewDest;
     MBBInfo->BrInstr = MIB.getInstr();
@@ -254,7 +254,7 @@ void X86CondBrFolding::fixupModifiedCond(MachineBasicBlock *MBB) {
 
   MachineInstr *BrMI = MBBInfo->BrInstr;
   X86::CondCode CC = MBBInfo->BranchCode;
-  MachineInstrBuilder MIB = BuildMI(*MBB, BrMI, MBB->findDebugLoc(BrMI),
+  MachineInstrBuilder MIB = BuildMI(*MBB, BrMI, MBB->findDebugLoc((llvm::MachineBasicBlock::iterator) BrMI),
                                     TII->get(GetCondBranchFromCond(CC)))
                                 .addMBB(MBBInfo->TBB);
   BrMI->eraseFromParent();
-- 
2.20.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions