diff --git a/src/CodeGen_C.cpp b/src/CodeGen_C.cpp index de4cd010a7d3..c5b64f0610f5 100644 --- a/src/CodeGen_C.cpp +++ b/src/CodeGen_C.cpp @@ -2558,6 +2558,8 @@ void CodeGen_C::visit(const Call *op) { user_error << "Signed integer overflow occurred during constant-folding. Signed" " integer overflow for int32 and int64 is undefined behavior in" " Halide.\n"; + } else if (op->is_intrinsic(Call::undef)) { + user_error << "undef not eliminated before code generation. Please report this as a Halide bug.\n"; } else if (op->is_intrinsic(Call::prefetch)) { user_assert((op->args.size() == 4) && is_const_one(op->args[2])) << "Only prefetch of 1 cache line is supported in C backend.\n"; diff --git a/src/CodeGen_LLVM.cpp b/src/CodeGen_LLVM.cpp index ae1acdaf5bcd..938d7a0e23b6 100644 --- a/src/CodeGen_LLVM.cpp +++ b/src/CodeGen_LLVM.cpp @@ -3183,7 +3183,7 @@ void CodeGen_LLVM::visit(const Call *op) { " integer overflow for int32 and int64 is undefined behavior in" " Halide.\n"; } else if (op->is_intrinsic(Call::undef)) { - value = UndefValue::get(llvm_type_of(op->type)); + user_error << "undef not eliminated before code generation. Please report this as a Halide bug.\n"; } else if (op->is_intrinsic(Call::size_of_halide_buffer_t)) { llvm::DataLayout d(module.get()); value = ConstantInt::get(i32_t, (int)d.getTypeAllocSize(halide_buffer_t_type));