[llvm] [TTI] Fix haveFastClmul to access inherited DL via thisT() (NFC) (PR #210647)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 19 23:01:02 PDT 2026
https://github.com/msolk created https://github.com/llvm/llvm-project/pull/210647
haveFastClmul() called DL.getIndexType()/DL.getAllocaAddrSpace()
directly, relying on the `using TargetTransformInfoImplBase::DL;`
declaration in BasicTTIImplBase to bring the inherited DataLayout
reference into scope. Because DL is reached through a two-level
dependent base chain (BasicTTIImplBase<T> -> TargetTransformInfoImplCRTPBase<T>
-> TargetTransformInfoImplBase), some compilers (observed with GCC
8.5.0) mis-resolve the member access and reject the code with a
misleading diagnostic naming TargetTransformInfoImplBase rather than
DataLayout.
Access DL via thisT()->DL instead, matching the pattern already used
elsewhere in this file (e.g. getABITypeAlign() call sites), which
forces lookup to be deferred to instantiation time and avoids the
compiler-version-dependent behavior.
>From 03d2796996be2a95a539d498e4184f0456177a47 Mon Sep 17 00:00:00 2001
From: Mayank Solanki <mayank.solanki at amd.com>
Date: Mon, 20 Jul 2026 11:21:04 +0530
Subject: [PATCH] [TTI] Fix haveFastClmul to access inherited DL via thisT()
(NFC)
haveFastClmul() called DL.getIndexType()/DL.getAllocaAddrSpace()
directly, relying on the `using TargetTransformInfoImplBase::DL;`
declaration in BasicTTIImplBase to bring the inherited DataLayout
reference into scope. Because DL is reached through a two-level
dependent base chain (BasicTTIImplBase<T> -> TargetTransformInfoImplCRTPBase<T>
-> TargetTransformInfoImplBase), some compilers (observed with GCC
8.5.0) mis-resolve the member access and reject the code with a
misleading diagnostic naming TargetTransformInfoImplBase rather than
DataLayout.
Access DL via thisT()->DL instead, matching the pattern already used
elsewhere in this file (e.g. getABITypeAlign() call sites), which
forces lookup to be deferred to instantiation time and avoids the
compiler-version-dependent behavior.
---
llvm/include/llvm/CodeGen/BasicTTIImpl.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
index 3240b9fd861e4..23f2168cf4eb7 100644
--- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h
+++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
@@ -686,8 +686,8 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
// FIXME: clmul should really be Promote for any bitwidth under the largest
// legal bitwidth for clmul. Using IndexTy instead of Ty is a hack to get
// around that shortcoming.
- IntegerType *IndexTy =
- DL.getIndexType(Ty->getContext(), DL.getAllocaAddrSpace());
+ IntegerType *IndexTy = thisT()->DL.getIndexType(
+ Ty->getContext(), thisT()->DL.getAllocaAddrSpace());
if (Ty->getBitWidth() > IndexTy->getBitWidth())
return false;
More information about the llvm-commits
mailing list