diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 7 | ||||
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/WinException.cpp | 8 | ||||
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/WinException.h | 3 | ||||
-rw-r--r-- | llvm/lib/Target/X86/X86FrameLowering.cpp | 3 | ||||
-rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 3 |
5 files changed, 15 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 52dbd5a9df4..f073118fd00 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -2480,8 +2480,11 @@ void AsmPrinter::EmitBasicBlockStart(const MachineBasicBlock &MBB) const { if (isVerbose()) OutStreamer->AddComment("Block address taken"); - for (MCSymbol *Sym : MMI->getAddrLabelSymbolToEmit(BB)) - OutStreamer->EmitLabel(Sym); + // MBBs can have their address taken as part of CodeGen without having + // their corresponding BB's address taken in IR + if (BB->hasAddressTaken()) + for (MCSymbol *Sym : MMI->getAddrLabelSymbolToEmit(BB)) + OutStreamer->EmitLabel(Sym); } // Print some verbose block comments. diff --git a/llvm/lib/CodeGen/AsmPrinter/WinException.cpp b/llvm/lib/CodeGen/AsmPrinter/WinException.cpp index 58103836a09..3999268b407 100644 --- a/llvm/lib/CodeGen/AsmPrinter/WinException.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/WinException.cpp @@ -273,12 +273,10 @@ const MCExpr *WinException::create32bitRef(const MCSymbol *Value) { Asm->OutContext); } -const MCExpr *WinException::create32bitRef(const Value *V) { - if (!V) +const MCExpr *WinException::create32bitRef(const GlobalValue *GV) { + if (!GV) return MCConstantExpr::create(0, Asm->OutContext); - if (const auto *GV = dyn_cast<GlobalValue>(V)) - return create32bitRef(Asm->getSymbol(GV)); - return create32bitRef(MMI->getAddrLabelSymbol(cast<BasicBlock>(V))); + return create32bitRef(Asm->getSymbol(GV)); } const MCExpr *WinException::getLabelPlusOne(const MCSymbol *Label) { diff --git a/llvm/lib/CodeGen/AsmPrinter/WinException.h b/llvm/lib/CodeGen/AsmPrinter/WinException.h index e553c3ff736..02134d6aa98 100644 --- a/llvm/lib/CodeGen/AsmPrinter/WinException.h +++ b/llvm/lib/CodeGen/AsmPrinter/WinException.h @@ -18,6 +18,7 @@ namespace llvm { class Function; +class GlobalValue; class MachineFunction; class MCExpr; class Value; @@ -66,7 +67,7 @@ class LLVM_LIBRARY_VISIBILITY WinException : public EHStreamer { StringRef FLinkageName); const MCExpr *create32bitRef(const MCSymbol *Value); - const MCExpr *create32bitRef(const Value *V); + const MCExpr *create32bitRef(const GlobalValue *GV); const MCExpr *getLabelPlusOne(const MCSymbol *Label); const MCExpr *getOffset(const MCSymbol *OffsetOf, const MCSymbol *OffsetFrom); const MCExpr *getOffsetPlusOne(const MCSymbol *OffsetOf, diff --git a/llvm/lib/Target/X86/X86FrameLowering.cpp b/llvm/lib/Target/X86/X86FrameLowering.cpp index a1a18fe6bd2..95cb76094ec 100644 --- a/llvm/lib/Target/X86/X86FrameLowering.cpp +++ b/llvm/lib/Target/X86/X86FrameLowering.cpp @@ -1178,6 +1178,9 @@ void X86FrameLowering::emitEpilogue(MachineFunction &MF, .addReg(ReturnReg) .addMBB(RestoreMBB); } + // Record that we've taken the address of RestoreMBB and no longer just + // reference it in a terminator. + RestoreMBB->setHasAddressTaken(); } if (MBBI != MBB.end()) diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 0de6acd5879..0d0e4823c38 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -21471,7 +21471,7 @@ X86TargetLowering::emitEHSjLjSetJmp(MachineInstr *MI, // For v = setjmp(buf), we generate // // thisMBB: - // buf[LabelOffset] = restoreMBB + // buf[LabelOffset] = restoreMBB <-- takes address of restoreMBB // SjLjSetup restoreMBB // // mainMBB: @@ -21491,6 +21491,7 @@ X86TargetLowering::emitEHSjLjSetJmp(MachineInstr *MI, MF->insert(I, mainMBB); MF->insert(I, sinkMBB); MF->push_back(restoreMBB); + restoreMBB->setHasAddressTaken(); MachineInstrBuilder MIB; |