[llvm] [Attributor] Use more appropriate approach to check flat address space (PR #108713)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 15 05:31:08 PDT 2024


================
@@ -3294,6 +3295,27 @@ InformationCache::getIndirectlyCallableFunctions(Attributor &A) const {
   return IndirectlyCallableFunctions;
 }
 
+unsigned InformationCache::getFlatAddressSpace(const Function *F) {
+  if (!F)
+    return getAssumedFlatAddressSpace();
+  auto *TTI = getAnalysisResultForFunction<TargetIRAnalysis>(*F);
+  if (!TTI)
+    return getAssumedFlatAddressSpace();
+  return TTI->getFlatAddressSpace();
----------------
arsenm wrote:

If you're just going to hardcode it based on the triple below, there's not much point in querying TTI 

https://github.com/llvm/llvm-project/pull/108713


More information about the llvm-commits mailing list