llvm / clangir

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

Noreturn call is not properly handled, should stop codegen after it #894

Open ghehg opened 6 days ago

ghehg commented 6 days ago

The changes from PR893 exposed a problem that CIR gen is ignoring noreturn call. e.g for following C code

void abort();
void test() { abort(); }

Clangir generates

define dso_local void @test() #1  {
  call void @abort(), 
  ret void
}

which is not right, right code should be like,

define dso_local void @test() #1  {
  call void @abort(), !dbg !8
  unreachable
}

Source code here needs implementation for no return call