[llvm] 04224d1 - [InferAddressSpaces] Register pass. (#65639)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 7 13:35:19 PDT 2023


Author: Harald van Dijk
Date: 2023-09-07T21:35:16+01:00
New Revision: 04224d1ae72388b9b217555049f4219737ee26c6

URL: https://github.com/llvm/llvm-project/commit/04224d1ae72388b9b217555049f4219737ee26c6
DIFF: https://github.com/llvm/llvm-project/commit/04224d1ae72388b9b217555049f4219737ee26c6.diff

LOG: [InferAddressSpaces] Register pass. (#65639)

InferAddressSpaces failed to call its initialization function. It was
still called through initializeScalarOpts in llc and opt, but it was
skipped entirely in clang. When the initialization function is not
called, this results in confusing behavior where the pass appears to
run, but not entirely as it should, e.g. the pass is excluded from
-print-before-all and -print-after-all.

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp b/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
index 8fc929ccbb3bd0..2da521375c0016 100644
--- a/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
+++ b/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
@@ -165,8 +165,12 @@ class InferAddressSpaces : public FunctionPass {
   static char ID;
 
   InferAddressSpaces()
-      : FunctionPass(ID), FlatAddrSpace(UninitializedAddressSpace) {}
-  InferAddressSpaces(unsigned AS) : FunctionPass(ID), FlatAddrSpace(AS) {}
+      : FunctionPass(ID), FlatAddrSpace(UninitializedAddressSpace) {
+    initializeInferAddressSpacesPass(*PassRegistry::getPassRegistry());
+  }
+  InferAddressSpaces(unsigned AS) : FunctionPass(ID), FlatAddrSpace(AS) {
+    initializeInferAddressSpacesPass(*PassRegistry::getPassRegistry());
+  }
 
   void getAnalysisUsage(AnalysisUsage &AU) const override {
     AU.setPreservesCFG();


        


More information about the llvm-commits mailing list