[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-18 Thread Yaxun Liu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL303370: CodeGen: Cast alloca to expected address space (authored by yaxunl). Changed prior to commit: https://reviews.llvm.org/D32248?vs=99204=99479#toc Repository: rL LLVM

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-17 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment. Any further comments? Thanks. https://reviews.llvm.org/D32248 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-16 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. Looks great, thank you for being patient. https://reviews.llvm.org/D32248 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-16 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added inline comments. Comment at: lib/CodeGen/TargetInfo.cpp:7294 llvm::PointerType *T, QualType QT) const override; + }; yaxunl wrote: > rjmccall wrote: > > Spurious newline? > will remove it. Sorry this line is needed to separate it from the

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-16 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 99204. yaxunl marked 4 inline comments as done. yaxunl added a comment. Herald added a subscriber: nhaehnle. Removed special handling of OpenCL from getTargetAddressSpace. https://reviews.llvm.org/D32248 Files: include/clang/AST/ASTContext.h

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-16 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl marked 14 inline comments as done. yaxunl added inline comments. Comment at: lib/CodeGen/CodeGenTypes.cpp:95 - /// isRecordLayoutComplete - Return true if the specified type is already Anastasia wrote: > Why this change? Will undo it.

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-16 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: lib/CodeGen/TargetInfo.cpp:411 +CodeGen::CodeGenFunction , llvm::Value *Src, unsigned SrcAddr, +unsigned DestAddr, llvm::Type *DestTy, bool isNonNull) const { // Since target may map different address spaces in AST to the

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-16 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added inline comments. Comment at: lib/CodeGen/CodeGenTypes.cpp:95 - /// isRecordLayoutComplete - Return true if the specified type is already Why this change? Comment at: lib/CodeGen/TargetInfo.cpp:411 +

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-16 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: lib/CodeGen/TargetInfo.cpp:7296 + unsigned getASTAllocaAddressSpace() const override { +return LangAS::Count + getABIInfo().getDataLayout().getAllocaAddrSpace(); + } yaxunl wrote: > rjmccall wrote: > > yaxunl

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-16 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added inline comments. Comment at: lib/CodeGen/TargetInfo.cpp:7296 + unsigned getASTAllocaAddressSpace() const override { +return LangAS::Count + getABIInfo().getDataLayout().getAllocaAddrSpace(); + } rjmccall wrote: > yaxunl wrote: > > rjmccall

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-16 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: lib/CodeGen/TargetInfo.cpp:7296 + unsigned getASTAllocaAddressSpace() const override { +return LangAS::Count + getABIInfo().getDataLayout().getAllocaAddrSpace(); + } yaxunl wrote: > rjmccall wrote: > > Can we

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-16 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 99149. yaxunl marked an inline comment as done. yaxunl added a comment. Revised by John's comments. https://reviews.llvm.org/D32248 Files: include/clang/AST/ASTContext.h include/clang/AST/Type.h include/clang/Basic/AddressSpaces.h

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-16 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl marked 13 inline comments as done. yaxunl added inline comments. Comment at: lib/CodeGen/TargetInfo.cpp:7296 + unsigned getASTAllocaAddressSpace() const override { +return LangAS::Count + getABIInfo().getDataLayout().getAllocaAddrSpace(); + }

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-16 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: lib/CodeGen/CGDecl.cpp:1120 +address.getPointer()->getType()->getPointerElementType()->getPointerTo( +getContext().getTargetAddressSpace(T.getAddressSpace())), +/*non-null*/ true); A lot of

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-15 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 99099. yaxunl added a comment. Revised by John's comments. https://reviews.llvm.org/D32248 Files: include/clang/AST/Type.h include/clang/Basic/DiagnosticSemaKinds.td lib/CodeGen/CGDecl.cpp lib/CodeGen/CGExprScalar.cpp lib/CodeGen/CodeGenModule.cpp

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-15 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added inline comments. Comment at: lib/CodeGen/CGDecl.cpp:1119 + T.getAddressSpace(), address.getPointer()->getType()-> + getPointerElementType()->getPointerTo(getContext().getTargetAddressSpace( + T.getAddressSpace())), true); rjmccall

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-15 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 99094. yaxunl added a comment. Fix format. https://reviews.llvm.org/D32248 Files: include/clang/AST/Type.h include/clang/Basic/DiagnosticSemaKinds.td lib/CodeGen/CGDecl.cpp lib/CodeGen/CGExprScalar.cpp lib/CodeGen/CodeGenTypes.cpp

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-15 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment. Looking good. We had some overlapping patches and comments there, so I want to make sure you didn't miss my comment on EmitAutoVarAlloca. Comment at: lib/Sema/SemaDecl.cpp:7205 +} +assert (T.getAddressSpace() != LangAS::opencl_constant); +

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-15 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 99061. yaxunl added a comment. Fix diagnostic for global addr https://reviews.llvm.org/D32248 Files: include/clang/AST/Type.h include/clang/Basic/DiagnosticSemaKinds.td lib/CodeGen/CGDecl.cpp lib/CodeGen/CGExprScalar.cpp

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-15 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: lib/Sema/SemaDecl.cpp:7210 + return; +} } err_opencl_function_variable seems like a better diagnostic, at least for opencl_global. You can fall back on this more general diagnostic for other address

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-15 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 99056. yaxunl marked an inline comment as done. yaxunl added a comment. diagnose automatic var with invalid addr space for OpenCL. https://reviews.llvm.org/D32248 Files: include/clang/AST/Type.h include/clang/Basic/DiagnosticSemaKinds.td

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-15 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: lib/CodeGen/CGDecl.cpp:1115 + assert(T.getAddressSpace() == LangAS::Default || + T.getQualifiers().hasTargetSpecificAddressSpace()); + auto Addr = getTargetHooks().performAddrSpaceCast(*this, yaxunl wrote: >

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-15 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl marked 2 inline comments as done. yaxunl added inline comments. Comment at: lib/CodeGen/CGDecl.cpp:1115 + assert(T.getAddressSpace() == LangAS::Default || + T.getQualifiers().hasTargetSpecificAddressSpace()); + auto Addr =

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-15 Thread Tony Tye via Phabricator via cfe-commits
t-tye added inline comments. Comment at: lib/CodeGen/CGDecl.cpp:1115 + assert(T.getAddressSpace() == LangAS::Default || + T.getQualifiers().hasTargetSpecificAddressSpace()); + auto Addr = getTargetHooks().performAddrSpaceCast(*this, Should allowing

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-15 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 99014. yaxunl added a comment. Removed adjustAddrSpaceForAutoVar and use performAddrSpaceCast instead. https://reviews.llvm.org/D32248 Files: include/clang/AST/Type.h lib/CodeGen/CGDecl.cpp lib/CodeGen/CGExprScalar.cpp lib/CodeGen/CodeGenTypes.cpp

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-11 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: lib/CodeGen/TargetInfo.cpp:7291 + Address adjustAddrSpaceForAutoVar(Address A, const VarDecl *VD, + CodeGen::CodeGenFunction ) const override; }; yaxunl wrote: > rjmccall wrote: > > yaxunl wrote: > > > rjmccall

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-11 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added inline comments. Comment at: lib/CodeGen/TargetInfo.cpp:7291 + Address adjustAddrSpaceForAutoVar(Address A, const VarDecl *VD, + CodeGen::CodeGenFunction ) const override; }; rjmccall wrote: > yaxunl wrote: > > rjmccall wrote: > > > How

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-11 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: lib/CodeGen/TargetInfo.cpp:7291 + Address adjustAddrSpaceForAutoVar(Address A, const VarDecl *VD, + CodeGen::CodeGenFunction ) const override; }; yaxunl wrote: > rjmccall wrote: > > How about, instead of

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-11 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added inline comments. Comment at: lib/CodeGen/TargetInfo.cpp:7291 + Address adjustAddrSpaceForAutoVar(Address A, const VarDecl *VD, + CodeGen::CodeGenFunction ) const override; }; rjmccall wrote: > How about, instead of introducing a second

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-10 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: lib/CodeGen/TargetInfo.cpp:7291 + Address adjustAddrSpaceForAutoVar(Address A, const VarDecl *VD, + CodeGen::CodeGenFunction ) const override; }; How about, instead of introducing a second method, we just change

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-09 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 98314. yaxunl added a comment. Revised by reviewers' comments. https://reviews.llvm.org/D32248 Files: include/clang/AST/Type.h lib/CodeGen/CGDecl.cpp lib/CodeGen/CodeGenTypes.cpp lib/CodeGen/TargetInfo.cpp lib/CodeGen/TargetInfo.h

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-08 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl marked 2 inline comments as done. yaxunl added inline comments. Comment at: test/CodeGenCXX/amdgcn-automatic-variable.cpp:25 + // CHECK: store i32 2, i32* %[[r1]] + int lv1; + lv1 = 1; yaxunl wrote: > Anastasia wrote: > > I am wondering if all these

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-08 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl marked 18 inline comments as done. yaxunl added inline comments. Comment at: lib/CodeGen/CGDecl.cpp:1115 + if (AddrTy->getAddressSpace() != ExpectedAddrSpace && + Ty.getAddressSpace() != LangAS::opencl_constant) { +address =

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-08 Thread Tony Tye via Phabricator via cfe-commits
t-tye added inline comments. Comment at: lib/CodeGen/CGDecl.cpp:1115 + if (AddrTy->getAddressSpace() != ExpectedAddrSpace && + Ty.getAddressSpace() != LangAS::opencl_constant) { +address = Address(Builder.CreateAddrSpaceCast(Addr, Anastasia wrote: > Do

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-08 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added inline comments. Comment at: lib/CodeGen/CGDecl.cpp:1105-1119 + // Alloca always returns a pointer in alloca address space, which may + // be different from the type defined by the language. For example, + // in C++ the auto variables are in the default address

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-04-25 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added inline comments. Comment at: lib/CodeGen/CGDecl.cpp:1105-1119 + // Alloca always returns a pointer in alloca address space, which may + // be different from the type defined by the language. For example, + // in C++ the auto variables are in the default

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-04-24 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: lib/CodeGen/CGDecl.cpp:1105-1119 + // Alloca always returns a pointer in alloca address space, which may + // be different from the type defined by the language. For example, + // in C++ the auto variables are in the default address

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-04-24 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added inline comments. Comment at: lib/CodeGen/CGDecl.cpp:1105-1119 + // Alloca always returns a pointer in alloca address space, which may + // be different from the type defined by the language. For example, + // in C++ the auto variables are in the default address

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-04-24 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: lib/CodeGen/CGDecl.cpp:1105-1119 + // Alloca always returns a pointer in alloca address space, which may + // be different from the type defined by the language. For example, + // in C++ the auto variables are in the default address

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-04-24 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added inline comments. Comment at: lib/CodeGen/CGDecl.cpp:1115 + if (AddrTy->getAddressSpace() != ExpectedAddrSpace && + Ty.getAddressSpace() != LangAS::opencl_constant) { +address = Address(Builder.CreateAddrSpaceCast(Addr, Do you need to

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-04-24 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added inline comments. Comment at: lib/CodeGen/CGDecl.cpp:1105-1119 + // Alloca always returns a pointer in alloca address space, which may + // be different from the type defined by the language. For example, + // in C++ the auto variables are in the default

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-04-20 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added inline comments. Comment at: lib/CodeGen/CGDecl.cpp:1105-1119 + // Alloca always returns a pointer in alloca address space, which may + // be different from the type defined by the language. For example, + // in C++ the auto variables are in the default address

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-04-19 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: lib/CodeGen/CGDecl.cpp:1118 +AddrTy->getElementType()->getPointerTo(ExpectedAddrSpace)), +address.getAlignment()); + } This is a lot of work to be doing in a pretty common routine for the benefit of

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-04-19 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added inline comments. Comment at: lib/CodeGen/CGDecl.cpp:1105-1119 + // Alloca always returns a pointer in alloca address space, which may + // be different from the type defined by the language. For example, + // in C++ the auto variables are in the default address

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-04-19 Thread Tony Tye via Phabricator via cfe-commits
t-tye added inline comments. Comment at: lib/CodeGen/CGDecl.cpp:1105-1119 + // Alloca always returns a pointer in alloca address space, which may + // be different from the type defined by the language. For example, + // in C++ the auto variables are in the default address

[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-04-19 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl created this revision. Alloca always returns a pointer in alloca address space, which may be different from the type defined by the language. For example, in C++ the auto variables are in the default address space. Therefore cast alloca to the expected address space when necessary.