diff options
author | Yaxun Liu <Yaxun.Liu@amd.com> | 2017-12-02 22:13:22 +0000 |
---|---|---|
committer | Yaxun Liu <Yaxun.Liu@amd.com> | 2017-12-02 22:13:22 +0000 |
commit | 494770403a9d764d367ed8428be139709b6dd29d (patch) | |
tree | 87c8e9802be1358a9f375da7fdeff06032493a1b /llvm/lib/CodeGen/MachineOperand.cpp | |
parent | c256a4ed179ba7cd1459e0846a18ecf06fb82b3d (diff) | |
download | llvm-494770403a9d764d367ed8428be139709b6dd29d.zip llvm-494770403a9d764d367ed8428be139709b6dd29d.tar.gz llvm-494770403a9d764d367ed8428be139709b6dd29d.tar.bz2 |
CodeGen: Fix pointer info in SplitVecOp_EXTRACT_VECTOR_ELT/SplitVecRes_INSERT_VECTOR_ELT
Two issues found when doing codegen for splitting vector with non-zero alloca addr space:
DAGTypeLegalizer::SplitVecRes_INSERT_VECTOR_ELT/SplitVecOp_EXTRACT_VECTOR_ELT uses dummy pointer info for creating
SDStore. Since one pointer operand contains multiply and add, InferPointerInfo is unable to
infer the correct pointer info, which ends up with a dummy pointer info for the target to lower
store and results in isel failure. The fix is to introduce MachinePointerInfo::getUnknownStack to
represent MachinePointerInfo which is known in alloca address space but without other information.
TargetLowering::getVectorElementPointer uses value type of pointer in addr space 0 for
multiplication of index and then add it to the pointer. However the pointer may be in an addr
space which has different size than addr space 0. The fix is to use the pointer value type for
index multiplication.
Differential Revision: https://reviews.llvm.org/D39758
llvm-svn: 319622
Diffstat (limited to 'llvm/lib/CodeGen/MachineOperand.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineOperand.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/llvm/lib/CodeGen/MachineOperand.cpp b/llvm/lib/CodeGen/MachineOperand.cpp index cb34259..2dbf57f 100644 --- a/llvm/lib/CodeGen/MachineOperand.cpp +++ b/llvm/lib/CodeGen/MachineOperand.cpp @@ -534,16 +534,7 @@ LLVM_DUMP_METHOD void MachineOperand::dump() const { dbgs() << *this << '\n'; } /// getAddrSpace - Return the LLVM IR address space number that this pointer /// points into. -unsigned MachinePointerInfo::getAddrSpace() const { - if (V.isNull()) - return 0; - - if (V.is<const PseudoSourceValue *>()) - return V.get<const PseudoSourceValue *>()->getAddressSpace(); - - return cast<PointerType>(V.get<const Value *>()->getType()) - ->getAddressSpace(); -} +unsigned MachinePointerInfo::getAddrSpace() const { return AddrSpace; } /// isDereferenceable - Return true if V is always dereferenceable for /// Offset + Size byte. @@ -586,6 +577,10 @@ MachinePointerInfo MachinePointerInfo::getStack(MachineFunction &MF, return MachinePointerInfo(MF.getPSVManager().getStack(), Offset, ID); } +MachinePointerInfo MachinePointerInfo::getUnknownStack(MachineFunction &MF) { + return MachinePointerInfo(MF.getDataLayout().getAllocaAddrSpace()); +} + MachineMemOperand::MachineMemOperand(MachinePointerInfo ptrinfo, Flags f, uint64_t s, unsigned int a, const AAMDNodes &AAInfo, |