I’m trying to add the StructurizeCFG pass with a legacy::PassManager:
// other passes
But I get this error when I attempt to to run it:
Pass ‘Structurize control flow’ is not initialized.
Verify if there is a pass dependency cycle.
Lower SwitchInst’s to branches
Dominator Tree Construction
Assertion failed: (PI && “Expected required passes to be initialized”), function schedulePass, file /path/to/llvm/lib/IR/LegacyPassManager.cpp, line 640.
StructurizeCFG calls initializeStructurizeCFGPass from its constructor, so it would seem to me that the pass should have been initialized. Predictably, explicitly calling it myself does not change anything.
There appears to be only one use of StructurizeCFG (from the AMD GPU backend), and I’m not familiar enough with the backend architecture to figure out what it’s doing that I’m not.
Am I missing something obvious?