diff options
| author | Nico Weber <nicolasweber@gmx.de> | 2016-12-14 21:38:18 +0000 |
|---|---|---|
| committer | Nico Weber <nicolasweber@gmx.de> | 2016-12-14 21:38:18 +0000 |
| commit | 7849eeb0359e086870633437529c7f8a6a30a952 (patch) | |
| tree | f6e8d655f9a1feba6677efeb815d749321625ee1 /clang/lib/CodeGen/TargetInfo.cpp | |
| parent | 65aedad62862a356c49fc5457277fb0c9cd3a75a (diff) | |
| download | bcm5719-llvm-7849eeb0359e086870633437529c7f8a6a30a952.tar.gz bcm5719-llvm-7849eeb0359e086870633437529c7f8a6a30a952.zip | |
Revert 289252 (and follow-up 289285), it caused PR31374
llvm-svn: 289713
Diffstat (limited to 'clang/lib/CodeGen/TargetInfo.cpp')
| -rw-r--r-- | clang/lib/CodeGen/TargetInfo.cpp | 36 |
1 files changed, 1 insertions, 35 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index 391eb53d250..38b164b113a 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -401,20 +401,6 @@ unsigned TargetCodeGenInfo::getOpenCLKernelCallingConv() const { return llvm::CallingConv::C; } -llvm::Constant *TargetCodeGenInfo::getNullPointer(const CodeGen::CodeGenModule &CGM, - llvm::PointerType *T, QualType QT) const { - return llvm::ConstantPointerNull::get(T); -} - -llvm::Value *TargetCodeGenInfo::performAddrSpaceCast( - CodeGen::CodeGenFunction &CGF, llvm::Value *Src, QualType SrcTy, - QualType DestTy) const { - // Since target may map different address spaces in AST to the same address - // space, an address space conversion may end up as a bitcast. - return CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(Src, - CGF.ConvertType(DestTy)); -} - static bool isEmptyRecord(ASTContext &Context, QualType T, bool AllowArrays); /// isEmptyField - Return true iff a the field is "empty", that is it @@ -7089,10 +7075,8 @@ public: void setTargetAttributes(const Decl *D, llvm::GlobalValue *GV, CodeGen::CodeGenModule &M) const override; unsigned getOpenCLKernelCallingConv() const override; - - llvm::Constant *getNullPointer(const CodeGen::CodeGenModule &CGM, - llvm::PointerType *T, QualType QT) const override; }; + } static void appendOpenCLVersionMD (CodeGen::CodeGenModule &CGM); @@ -7156,24 +7140,6 @@ unsigned AMDGPUTargetCodeGenInfo::getOpenCLKernelCallingConv() const { return llvm::CallingConv::AMDGPU_KERNEL; } -// Currently LLVM assumes null pointers always have value 0, -// which results in incorrectly transformed IR. Therefore, instead of -// emitting null pointers in private and local address spaces, a null -// pointer in generic address space is emitted which is casted to a -// pointer in local or private address space. -llvm::Constant *AMDGPUTargetCodeGenInfo::getNullPointer( - const CodeGen::CodeGenModule &CGM, llvm::PointerType *PT, - QualType QT) const { - if (CGM.getContext().getTargetNullPointerValue(QT) == 0) - return llvm::ConstantPointerNull::get(PT); - - auto &Ctx = CGM.getContext(); - auto NPT = llvm::PointerType::get(PT->getElementType(), - Ctx.getTargetAddressSpace(LangAS::opencl_generic)); - return llvm::ConstantExpr::getAddrSpaceCast( - llvm::ConstantPointerNull::get(NPT), PT); -} - //===----------------------------------------------------------------------===// // SPARC v8 ABI Implementation. // Based on the SPARC Compliance Definition version 2.4.1. |

