<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi all,<div class=""><br class=""></div><div class="">I'm trying to add the StructurizeCFG pass with a legacy::PassManager:</div><div class=""><br class=""></div><div class=""><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>legacy::PassManager pm;</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>pm.add(createTypeBasedAliasAnalysisPass());</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>pm.add(createScopedNoAliasAAPass());</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>pm.add(createBasicAliasAnalysisPass());</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>// other passes</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>pm.add(createStructurizeCFGPass());</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>pm.run(*module);</div></div><div class=""><br class=""></div><div class="">But I get this error when I attempt to to run it:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><b class="">Pass 'Structurize control flow' is not initialized.</b></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><b class="">Verify if there is a pass dependency cycle.</b></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><b class="">Required Passes:</b></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><b class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Lower SwitchInst's to branches</b></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><b class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Dominator Tree Construction</b></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><b class="">Assertion failed: (PI && "Expected required passes to be initialized"), function schedulePass, file /path/to/llvm/lib/IR/LegacyPassManager.cpp, line 640.</b></div></div><div class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><div class="">Am I missing something obvious?</div><div class=""><br class=""></div><div class="">FĂ©lix</div></body></html>