You need to call “initializeMyExamplePass” ahead of time. Look at
include/llvm/InitializePasses.h, and for the actual calls that
initialize individual passes, at lib/Analysis/Analysis.cpp,
These are all called from “main” in opt.cpp.
Ah, right. Given the hint that I actually do need to arrange to call initialize myself, I’ve put the call to initializeMyExamplePass in LLVMInitializeMyTarget. That works fine and, now that I’ve looked more carefully, seems to be how other targets have done it.