[clang] [llvm] [TargetVerifier][AMDGPU] Add TargetVerifier. (PR #123609)

Shilei Tian via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 19 20:39:13 PDT 2025


shiltian wrote:

The target hook approach won't work here because `VerifierPass` is part of `LLVMCore`, so it can't depend on target-specific components and doing so would introduce a circular dependency.

Instead, I'm thinking of an alternative: make the target-dependent verifier run after the standard `VerifierPass`. For example, `PassBuilder` already supports callback registration. Maybe we can introduce a `registerVerifier` function that wraps and adds the `VerifierPass`. Alongside that, we could define something like `VerifierRegistrationCallbacks`, where each target can register its own verifier using `registerVerifierCallback`.

Then, wherever we currently call `addPass(VerifierPass())`, we'd replace it with `registerVerifier()`, which would insert both the core verifier and any target-specific verifiers.

Does this sound like a viable approach?

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


More information about the cfe-commits mailing list