https://github.com/llvm/llvm-project/pull/111223 was reverted because of a build failure with `-DBUILD_SHARED_LIBS=on`. The Passes component depends on Vectorizer (because PassBuilder needs to be able to instantiate SandboxVectorizerPass). This resulted in CMake doing this 1. when it builds lib/libLLVMVectorize.so.20.0git it adds lib/libLLVMSandboxIR.so.20.0git to the command line, because it's listed as a dependency (as expected) 2. when it's trying to build lib/libLLVMPasses.so.20.0git it adds lib/libLLVMVectorize.so.20.0git to the command line, because it's listed as a dependency (also as expected). But not libLLVMSandboxIR.so. When SandboxVectorizerPass has its ctors/dtors defined inline, this caused "undefined reference to vtable" linker errors. This change works around that by moving ctors/dtors out of line. Also fix a bazel build problem by adding the new `llvm/lib/Transforms/Vectorize/SandboxVectorizer/Passes/PassRegistry.def` as a textual header in the Vectorizer target.
34 lines
977 B
C++
34 lines
977 B
C++
//===- PassManager.cpp - Runs a pipeline of Sandbox IR passes -------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "llvm/SandboxIR/PassManager.h"
|
|
|
|
namespace llvm::sandboxir {
|
|
|
|
bool FunctionPassManager::runOnFunction(Function &F) {
|
|
bool Change = false;
|
|
for (auto &Pass : Passes) {
|
|
Change |= Pass->runOnFunction(F);
|
|
// TODO: run the verifier.
|
|
}
|
|
// TODO: Check ChangeAll against hashes before/after.
|
|
return Change;
|
|
}
|
|
|
|
bool RegionPassManager::runOnRegion(Region &R) {
|
|
bool Change = false;
|
|
for (auto &Pass : Passes) {
|
|
Change |= Pass->runOnRegion(R);
|
|
// TODO: run the verifier.
|
|
}
|
|
// TODO: Check ChangeAll against hashes before/after.
|
|
return Change;
|
|
}
|
|
|
|
} // namespace llvm::sandboxir
|