[PATCH] D26196: Add support for non-zero null pointers

2016-11-10 Thread John McCall via cfe-commits
rjmccall added inline comments. Comment at: lib/CodeGen/TargetInfo.cpp:7040 + auto AS = PT->getAddressSpace(); + return AS != Ctx.getTargetAddressSpace(LangAS::opencl_local) && AS != 0; +} yaxunl wrote: > rjmccall wrote: > > This check is definitely not correct;

[PATCH] D26196: Add support for non-zero null pointers

2016-11-10 Thread Yaxun Liu via cfe-commits
yaxunl updated this revision to Diff 77525. yaxunl marked an inline comment as done. yaxunl added a comment. Changed APValue to differentiate with null pointer and pointers casted from integer. Fixed casting integer to pointer. Refactored isNullPtrZero to use just QualType as parameter. Added t

[PATCH] D26196: Add support for non-zero null pointers

2016-11-10 Thread Yaxun Liu via cfe-commits
yaxunl marked 12 inline comments as done. yaxunl added inline comments. Comment at: lib/CodeGen/TargetInfo.cpp:7040 + auto AS = PT->getAddressSpace(); + return AS != Ctx.getTargetAddressSpace(LangAS::opencl_local) && AS != 0; +} rjmccall wrote: > This check is de

[PATCH] D26196: Add support for non-zero null pointers

2016-11-08 Thread John McCall via cfe-commits
rjmccall added a comment. In https://reviews.llvm.org/D26196#589493, @yaxunl wrote: > Fixed list initialization of large struct which are mostly initialized by 0 > through memset. > Added tests for casting literal 0 and non-literal integer to pointer. > > There are many more places need to be c

[PATCH] D26196: Add support for non-zero null pointers

2016-11-08 Thread John McCall via cfe-commits
rjmccall added inline comments. Comment at: lib/CodeGen/CGExprConstant.cpp:1340 + return C; +return getNullPtr(PT, DestType); } yaxunl wrote: > efriedma wrote: > > yaxunl wrote: > > > yaxunl wrote: > > > > rjmccall wrote: > > > > > efriedm

[PATCH] D26196: Add support for non-zero null pointers

2016-11-08 Thread Yaxun Liu via cfe-commits
yaxunl marked an inline comment as done. yaxunl added inline comments. Comment at: lib/CodeGen/CGExprConstant.cpp:1340 + return C; +return getNullPtr(PT, DestType); } efriedma wrote: > yaxunl wrote: > > yaxunl wrote: > > > rjmccall wrote:

[PATCH] D26196: Add support for non-zero null pointers

2016-11-08 Thread Eli Friedman via cfe-commits
efriedma added inline comments. Comment at: lib/CodeGen/CGExprConstant.cpp:1340 + return C; +return getNullPtr(PT, DestType); } yaxunl wrote: > yaxunl wrote: > > rjmccall wrote: > > > efriedma wrote: > > > > Consider code like the followin

[PATCH] D26196: Add support for non-zero null pointers

2016-11-08 Thread Yaxun Liu via cfe-commits
yaxunl marked 3 inline comments as done. yaxunl added inline comments. Comment at: lib/CodeGen/CGExprConstant.cpp:1340 + return C; +return getNullPtr(PT, DestType); } yaxunl wrote: > rjmccall wrote: > > efriedma wrote: > > > Consider code

[PATCH] D26196: Add support for non-zero null pointers

2016-11-08 Thread Yaxun Liu via cfe-commits
yaxunl updated this revision to Diff 77238. yaxunl marked 2 inline comments as done. yaxunl added a comment. Added isNullPtrZero to TargetCodeGenInfo. https://reviews.llvm.org/D26196 Files: lib/CodeGen/CGDecl.cpp lib/CodeGen/CGExprAgg.cpp lib/CodeGen/CGExprConstant.cpp lib/CodeGen/CGExp

[PATCH] D26196: Add support for non-zero null pointers

2016-11-08 Thread Yaxun Liu via cfe-commits
yaxunl added inline comments. Comment at: lib/CodeGen/CodeGenTypes.cpp:743 +auto NullPtr = CGM.getNullPtr(LLPT, T); +return isa(NullPtr); + } tony-tye wrote: > Is this correct if the target does not represent a NULL pointer as the > address with value 0

[PATCH] D26196: Add support for non-zero null pointers

2016-11-08 Thread Tony Tye via cfe-commits
tony-tye added inline comments. Comment at: lib/CodeGen/CodeGenTypes.cpp:743 +auto NullPtr = CGM.getNullPtr(LLPT, T); +return isa(NullPtr); + } Is this correct if the target does not represent a NULL pointer as the address with value 0? Or should this b

[PATCH] D26196: Add support for non-zero null pointers

2016-11-08 Thread Yaxun Liu via cfe-commits
yaxunl retitled this revision from "[WIP] Add support for non-zero null pointers" to "Add support for non-zero null pointers". yaxunl updated this revision to Diff 77210. yaxunl added a comment. Fixed list initialization of large struct which are mostly initialized by 0 through memset. Added tes