[PATCH] D75423: [OpenCL] Mark pointers to constant address space as invariant

2020-03-01 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl created this revision. yaxunl added reviewers: rjmccall, Anastasia, bader. OpenCL constant address space is immutable, therefore pointers to constant address space can be marked with llvm.invariant.start permanently. This should allow more optimization opportunities in LLVM passes. http

[PATCH] D75423: [OpenCL] Mark pointers to constant address space as invariant

2020-03-01 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: clang/lib/CodeGen/CGDeclCXX.cpp:172 + if (llvm::Constant *C = dyn_cast(Addr)) +Cast = llvm::ConstantExpr::getBitCast(C, ObjectPtr[0]); + else This check is already done by `CreateBitCast`. Comme

[PATCH] D75423: [OpenCL] Mark pointers to constant address space as invariant

2020-03-02 Thread Michael Liao via Phabricator via cfe-commits
hliao added a comment. invariant checking already takes account of loading from constant address space or memory (AA::pointsToConstantMemory), that's almost equivalent to adding invariant attributes. Why do we mark these constant loads with additional attributes? CHANGES SINCE LAST ACTION h

[PATCH] D75423: [OpenCL] Mark pointers to constant address space as invariant

2020-03-02 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment. In D75423#1901206 , @hliao wrote: > invariant checking already takes account of loading from constant address > space or memory (AA::pointsToConstantMemory), that's almost equivalent to > adding invariant attributes. Why do we m

[PATCH] D75423: [OpenCL] Mark pointers to constant address space as invariant

2020-03-02 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment. In D75423#1901206 , @hliao wrote: > invariant checking already takes account of loading from constant address > space or memory (AA::pointsToConstantMemory), that's almost equivalent to > adding invariant attributes. Why do we mar

[PATCH] D75423: [OpenCL] Mark pointers to constant address space as invariant

2020-03-02 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment. In D75423#1901254 , @rjmccall wrote: > In D75423#1901206 , @hliao wrote: > > > invariant checking already takes account of loading from constant address > > space or memory (AA::pointsToCons

[PATCH] D75423: [OpenCL] Mark pointers to constant address space as invariant

2020-03-02 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment. In D75423#1901348 , @yaxunl wrote: > In D75423#1901254 , @rjmccall wrote: > > > In D75423#1901206 , @hliao wrote: > > > > > invariant checking alrea

[PATCH] D75423: [OpenCL] Mark pointers to constant address space as invariant

2020-03-02 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment. In D75423#1901362 , @rjmccall wrote: > Okay, then I have no problem taking a patch for this into IRGen. But I think > it should be fine to do this by adding the invariant-load metadata when > loading from an l-value instead of in

[PATCH] D75423: [OpenCL] Mark pointers to constant address space as invariant

2020-03-02 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 247688. yaxunl marked 2 inline comments as done. yaxunl added a comment. revised by John's comments. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75423/new/ https://reviews.llvm.org/D75423 Files: clang/lib/CodeGen/CGDeclCXX.cpp clang/lib/CodeGe

[PATCH] D75423: [OpenCL] Mark pointers to constant address space as invariant

2020-03-02 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment. In D75423#1901407 , @yaxunl wrote: > In D75423#1901362 , @rjmccall wrote: > > > Okay, then I have no problem taking a patch for this into IRGen. But I > > think it should be fine to do th