[PATCH] D26196: Add support for non-zero null pointer for C and OpenCL

2016-12-09 Thread Yaxun Liu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL289252: Add support for non-zero null pointer for C and OpenCL (authored by yaxunl). Changed prior to commit: https://reviews.llvm.org/D26196?vs=80902=80919#toc Repository: rL LLVM

[PATCH] D26196: Add support for non-zero null pointer for C and OpenCL

2016-12-09 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision. rjmccall added a comment. This revision is now accepted and ready to land. Okay. With that resolved, this LGTM. https://reviews.llvm.org/D26196 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D26196: Add support for non-zero null pointer for C and OpenCL

2016-12-09 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 80902. yaxunl marked an inline comment as done. yaxunl added a comment. Revised by John's comments. Dropped constant folding of ptrtoint of non-zero null pointer. https://reviews.llvm.org/D26196 Files: include/clang/AST/APValue.h

[PATCH] D26196: Add support for non-zero null pointer for C and OpenCL

2016-12-09 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl marked an inline comment as done. yaxunl added inline comments. Comment at: lib/CodeGen/CGExprScalar.cpp:1532 + return llvm::ConstantInt::get(ConvertType(DestTy), + CGF.getContext().getTargetNullPtrValue(E->getType())); assert(!DestTy->isBooleanType()

[PATCH] D26196: Add support for non-zero null pointer for C and OpenCL

2016-12-08 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: lib/CodeGen/CGExprScalar.cpp:1532 + return llvm::ConstantInt::get(ConvertType(DestTy), + CGF.getContext().getTargetNullPtrValue(E->getType())); assert(!DestTy->isBooleanType() && "bool should use PointerToBool");

[PATCH] D26196: Add support for non-zero null pointer for C and OpenCL

2016-12-08 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated the summary for this revision. yaxunl updated this revision to Diff 80804. yaxunl marked an inline comment as done. yaxunl added a comment. Revised by John's comments. Added source QualType parameter to performAddrSpaceCast. Changed linkage of tentative definition of global var

[PATCH] D26196: Add support for non-zero null pointer for C and OpenCL

2016-12-07 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: lib/CodeGen/CGExprScalar.cpp:1532 + return llvm::ConstantInt::get(ConvertType(DestTy), + CGF.getContext().getTargetNullPtrValue(E->getType())); assert(!DestTy->isBooleanType() && "bool should use PointerToBool");

[PATCH] D26196: Add support for non-zero null pointer for C and OpenCL

2016-12-07 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated the summary for this revision. yaxunl updated this revision to Diff 80600. yaxunl marked an inline comment as done. yaxunl added a comment. Revised by John's comments. Fixed typos. Changed parameter of performAddrSpaceCast. Fixed constant folding of ptrtoint with side effect and

[PATCH] D26196: Add support for non-zero null pointer for C and OpenCL

2016-12-07 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl marked 4 inline comments as done. yaxunl added inline comments. Comment at: lib/CodeGen/CGExprScalar.cpp:1532 + return llvm::ConstantInt::get(ConvertType(DestTy), + CGF.getContext().getTargetNullPtrValue(E->getType())); assert(!DestTy->isBooleanType()

[PATCH] D26196: Add support for non-zero null pointer for C and OpenCL

2016-12-06 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: include/clang/AST/APValue.h:379 void setLValue(LValueBase B, const CharUnits , NoLValuePath, - unsigned CallIndex); + unsigned CallIndex, bool IsNuppPtr); void setLValue(LValueBase B, const

[PATCH] D26196: Add support for non-zero null pointer for C and OpenCL

2016-12-06 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 80488. yaxunl added a comment. Fix some missed function name and remove accidentally added #if 0. https://reviews.llvm.org/D26196 Files: include/clang/AST/APValue.h include/clang/AST/ASTContext.h include/clang/Basic/TargetInfo.h lib/AST/APValue.cpp

[PATCH] D26196: Add support for non-zero null pointer for C and OpenCL

2016-12-06 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 80485. yaxunl marked an inline comment as done. yaxunl added a comment. Revised by John's comments. Changed Ptr in function names to Pointer. Added TargetCodeGenInfo::performAddrSpaceCast. Fixed folding addrspacecast of null pointer with side effect and added

[PATCH] D26196: Add support for non-zero null pointer for C and OpenCL

2016-12-06 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl marked 7 inline comments as done. yaxunl added inline comments. Comment at: lib/CodeGen/CGExprScalar.cpp:1532 + return llvm::ConstantInt::get(ConvertType(DestTy), + CGF.getContext().getTargetNullPtrValue(E->getType())); assert(!DestTy->isBooleanType()

[PATCH] D26196: Add support for non-zero null pointer for C and OpenCL

2016-12-06 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: include/clang/Basic/TargetInfo.h:306 + /// \param AddrSpace address space of pointee in source language. + virtual uint64_t getNullPtrValue(unsigned AddrSpace) const { +return 0; We normally spell out "Pointer",

[PATCH] D26196: Add support for non-zero null pointer for C and OpenCL

2016-12-05 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment. ping https://reviews.llvm.org/D26196 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D26196: Add support for non-zero null pointer for C and OpenCL

2016-11-28 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated the summary for this revision. yaxunl updated this revision to Diff 79406. yaxunl added a comment. Revised by John's comments. Emit null pointer in target-specific representation in folded constant expressions. Fix casting null pointer to integer in constant expressions.

[PATCH] D26196: Add support for non-zero null pointer for C and OpenCL

2016-11-22 Thread John McCall via cfe-commits
rjmccall added a comment. In https://reviews.llvm.org/D26196#602660, @yaxunl wrote: > > But if you do need to support these conversions for some reason, the > > correct behavior is to ensure that null is mapped to null. > > I only need to do this for constant folding, right? I found that the

[PATCH] D26196: Add support for non-zero null pointer for C and OpenCL

2016-11-22 Thread Yaxun Liu via cfe-commits
yaxunl marked 3 inline comments as done. yaxunl added a comment. > But if you do need to support these conversions for some reason, the correct > behavior is to ensure that null is mapped to null. I only need to do this for constant folding, right? I found that the current implementation is

[PATCH] D26196: Add support for non-zero null pointer for C and OpenCL

2016-11-13 Thread John McCall via cfe-commits
rjmccall added a comment. In https://reviews.llvm.org/D26196#593741, @yaxunl wrote: > >> It seems the casting from a pointer to different address space is not > >> affected by this change. When a null pointer is casted to different > >> address space, it is casted the same way as an ordinary

[PATCH] D26196: Add support for non-zero null pointer for C and OpenCL

2016-11-12 Thread Yaxun Liu via cfe-commits
yaxunl added a comment. >> It seems the casting from a pointer to different address space is not >> affected by this change. When a null pointer is casted to different address >> space, it is casted the same way as an ordinary pointer, e.g. by >> addrspacecast. > > You mean, the

[PATCH] D26196: Add support for non-zero null pointer for C and OpenCL

2016-11-12 Thread Yaxun Liu via cfe-commits
yaxunl added a comment. >> It seems the casting from a pointer to different address space is not >> affected by this change. When a null pointer is casted to different address >> space, it is casted the same way as an ordinary pointer, e.g. by >> addrspacecast. > > You mean, the

[PATCH] D26196: Add support for non-zero null pointer for C and OpenCL

2016-11-12 Thread John McCall via cfe-commits
rjmccall added a comment. In https://reviews.llvm.org/D26196#592823, @yaxunl wrote: > Hi John, > > It seems the casting from a pointer to different address space is not > affected by this change. When a null pointer is casted to different address > space, it is casted the same way as an

[PATCH] D26196: Add support for non-zero null pointer for C and OpenCL

2016-11-11 Thread Yaxun Liu via cfe-commits
yaxunl added a comment. Hi John, It seems the casting from a pointer to different address space is not affected by this change. When a null pointer is casted to different address space, it is casted the same way as an ordinary pointer, e.g. by addrspacecast. I think this patch covers most of