
We get a lot of issues that basically boil down to "I passed malformed LLVM IR to clang and it crashed". Clang does not perform IR verification by default in (non-assertion-enabled) release builds, and that's sensible for IR that Clang itself produces, which is expected to always be valid. However, if people pass in their own handwritten IR, we should report if it is malformed, instead of crashing. We should also report it in a way that does not produce a crash trace and ask for a bug report, as currently happens in assertions-enabled builds. This aligns the behavior with how opt/llc work.
13 lines
364 B
LLVM
13 lines
364 B
LLVM
; RUN: not %clang %s 2>&1 | FileCheck %s
|
|
; RUN: llvm-as -disable-verify < %s > %t.bc
|
|
; RUN: not %clang %t.bc 2>&1 | FileCheck %s
|
|
|
|
; CHECK: error: invalid LLVM IR input: PHINode should have one entry for each predecessor of its parent basic block!
|
|
; CHECK-NEXT: %phi = phi i32 [ 0, %entry ]
|
|
|
|
define void @test() {
|
|
entry:
|
|
%phi = phi i32 [ 0, %entry ]
|
|
ret void
|
|
}
|