[PATCH] D49644: [COFF] Hoist constant pool handling from X86AsmPrinter into AsmPrinter
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 23 11:58:04 PDT 2018
mstorsjo added inline comments.
================
Comment at: lib/CodeGen/AsmPrinter/AsmPrinter.cpp:2669
+ const MachineConstantPoolEntry &CPE =
+ MF->getConstantPool()->getConstants()[CPID];
+ if (!CPE.isMachineConstantPoolEntry() && CPE.getType() &&
----------------
FWIW, in order to make test/CodeGen/ARM/setjmp_longjmp.ll pass reliably without out of bounds accesses, I have to do this extra modification:
```
@@ -2664,11 +2664,11 @@ MCSymbol *AsmPrinter::GetBlockAddressSymbol(const BasicBlock *BB) const {
/// GetCPISymbol - Return the symbol for the specified constant pool entry.
MCSymbol *AsmPrinter::GetCPISymbol(unsigned CPID) const {
- if (getSubtargetInfo().getTargetTriple().isOSWindows()) {
- const MachineConstantPoolEntry &CPE =
- MF->getConstantPool()->getConstants()[CPID];
+ const std::vector<MachineConstantPoolEntry> &CP =
+ MF->getConstantPool()->getConstants();
+ if (getSubtargetInfo().getTargetTriple().isOSWindows() && CPID < CP.size()) {
+ const MachineConstantPoolEntry &CPE = CP[CPID];
if (!CPE.isMachineConstantPoolEntry() && CPE.getType() &&
CPE.getType()->isSized()) {
const DataLayout &DL = MF->getDataLayout();
SectionKind Kind = CPE.getSectionKind(&DL);
```
I'll update the diff accordingly.
Repository:
rL LLVM
https://reviews.llvm.org/D49644
More information about the llvm-commits
mailing list