llvm / clangir

A new (MLIR based) high-level IR for clang.
https://clangir.org
Other
312 stars 86 forks source link

Module verification error of switch statements #588

Open wenpen opened 2 months ago

wenpen commented 2 months ago
struct St{
  ~St(){}
};

int f(int a) {
  switch(a) {
    case 1:{
      St a;
      return 1;
    }
  }
  return 0;
}
fatal error: error in backend: CIR codegen: module verification error before running CIR passes
wenpen commented 2 months ago

I know it's a verification error about SwitchOp, do we have some methods to print more information (e.g. the illegal cir body)?

Lancern commented 2 months ago

do we have some methods to print more information (e.g. the illegal cir body)?

Try -Xclang -clangir-disable-verifier -Xclang -clangir-disable-passes

bcardosolopes commented 2 months ago

Interesting, it usually says at least something about what failed to verify. Anyways, use the suggestions from Lancern to isolate the CIR output that can help you understand the bad IR