[llvm] 4c8e5c3 - [TTI] Fix haveFastClmul to access inherited DL via thisT() (#210647)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 20 23:57:07 PDT 2026


Author: Mayank
Date: 2026-07-21T06:57:01Z
New Revision: 4c8e5c3e8b462ebd664ac1ccd621005d9b365644

URL: https://github.com/llvm/llvm-project/commit/4c8e5c3e8b462ebd664ac1ccd621005d9b365644
DIFF: https://github.com/llvm/llvm-project/commit/4c8e5c3e8b462ebd664ac1ccd621005d9b365644.diff

LOG: [TTI] Fix haveFastClmul to access inherited DL via thisT() (#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.

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/BasicTTIImpl.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
index 3240b9fd861e4..837ab03ccdac5 100644
--- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h
+++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
@@ -686,6 +686,7 @@ 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.
+    const DataLayout &DL = thisT()->DL;
     IntegerType *IndexTy =
         DL.getIndexType(Ty->getContext(), DL.getAllocaAddrSpace());
     if (Ty->getBitWidth() > IndexTy->getBitWidth())


        


More information about the llvm-commits mailing list