Rewritten accordingly to the implementation of checkCFG function in backendlib