[clang] [Clang][OpenCL] Mark scalar loads from constant address space invariant (PR #218356)
Keshav Vinayak Jha via cfe-commits
cfe-commits at lists.llvm.org
Sun Nov 8 22:14:24 PST 2026
================
@@ -87,7 +87,8 @@ class CGBuilderTy : public CGBuilderBaseTy {
return Address(V, ElementTy,
Addr.getAlignment().alignmentAtOffset(
CharUnits::fromQuantity(Offset.getSExtValue())),
- IsInBounds ? Addr.isKnownNonNull() : NotKnownNonNull);
+ IsInBounds ? Addr.isKnownNonNull() : NotKnownNonNull)
+ .setInvariant(Addr.isInvariant());
----------------
keshavvinayak01 wrote:
Looking at this again, this is not a good design. I should add a new constructor that uses the invariant fact. HLS will also need handling in https://github.com/llvm/llvm-project/blob/add398e7ed51e681d4107d215078bb5c04291916/clang/lib/CodeGen/CGHLSLRuntime.cpp#L2776
So it's better I fix this first.
https://github.com/llvm/llvm-project/pull/218356
More information about the cfe-commits
mailing list