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
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
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
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
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
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.
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
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
+
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
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
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
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
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();
+ }
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
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
yaxunl added inline comments.
Comment at: lib/CodeGen/CGDecl.cpp:1119
+ T.getAddressSpace(), address.getPointer()->getType()->
+ getPointerElementType()->getPointerTo(getContext().getTargetAddressSpace(
+ T.getAddressSpace())), true);
rjmccall
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
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);
+
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
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
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
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:
>
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 =
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
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
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
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
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
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
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
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
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
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 =
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
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
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
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
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
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
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
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
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
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
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
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
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.
46 matches
Mail list logo