[PATCH] D71348: Add ExternalAAWrapperPass to createLegacyPMAAResults.

Neil Henning via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 11 05:31:56 PST 2019


sheredom created this revision.
sheredom added reviewers: nhaehnle, hfinkel.
Herald added subscribers: llvm-commits, hiraditya, tpr.
Herald added a project: LLVM.

Our out-of-tree custom aliasing solution for the HPC# Burst compiler here at Unity makes use of the `ExternalAAWrapperPass` infrastructure to insert our custom aliasing resolution into the core of LLVM. This is great for all cases except for function inlining, where because `createLegacyPMAAResults` does not make use of `ExternalAAWrapperPass`, when we have a definite no-alias result within a function that won't be propagated to the calling function during inlining.

This commit just rectifies this oversight by adding the missing dependency.

I wasn't sure how to test this given that the only in-tree user of the ExternalAAWrapperPass infrastructure is the AMDGPU backend - I'd appreciate guidance on that facet of this change.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71348

Files:
  llvm/lib/Analysis/AliasAnalysis.cpp


Index: llvm/lib/Analysis/AliasAnalysis.cpp
===================================================================
--- llvm/lib/Analysis/AliasAnalysis.cpp
+++ llvm/lib/Analysis/AliasAnalysis.cpp
@@ -846,6 +846,7 @@
   AU.addUsedIfAvailable<SCEVAAWrapperPass>();
   AU.addUsedIfAvailable<CFLAndersAAWrapperPass>();
   AU.addUsedIfAvailable<CFLSteensAAWrapperPass>();
+  AU.addUsedIfAvailable<ExternalAAWrapperPass>();
 }
 
 AAResults llvm::createLegacyPMAAResults(Pass &P, Function &F,
@@ -871,6 +872,9 @@
     AAR.addAAResult(WrapperPass->getResult());
   if (auto *WrapperPass = P.getAnalysisIfAvailable<CFLSteensAAWrapperPass>())
     AAR.addAAResult(WrapperPass->getResult());
+  if (auto *WrapperPass = P.getAnalysisIfAvailable<ExternalAAWrapperPass>())
+    if (WrapperPass->CB)
+      WrapperPass->CB(P, F, AAR);
 
   return AAR;
 }
@@ -914,4 +918,5 @@
   AU.addUsedIfAvailable<GlobalsAAWrapperPass>();
   AU.addUsedIfAvailable<CFLAndersAAWrapperPass>();
   AU.addUsedIfAvailable<CFLSteensAAWrapperPass>();
+  AU.addUsedIfAvailable<ExternalAAWrapperPass>();
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71348.233326.patch
Type: text/x-patch
Size: 1063 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191211/898b038c/attachment-0001.bin>


More information about the llvm-commits mailing list