[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.
This commit is contained in:
Harald van Dijk 2023-09-07 21:35:16 +01:00 committed by GitHub
parent 4bba12f722
commit 04224d1ae7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -165,8 +165,12 @@ public:
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();