Index: llvm/lib/IR/Verifier.cpp =================================================================== --- llvm/lib/IR/Verifier.cpp +++ llvm/lib/IR/Verifier.cpp @@ -3064,11 +3064,12 @@ Assert(verifyAttributeCount(Attrs, Call.arg_size()), "Attribute after last parameter!", Call); - bool IsIntrinsic = Call.getCalledFunction() && - Call.getCalledFunction()->isIntrinsic(); - Function *Callee = dyn_cast(Call.getCalledOperand()->stripPointerCasts()); + bool IsIntrinsic = Callee && Callee->isIntrinsic(); + if (IsIntrinsic) + Assert(Callee->getValueType() == FTy, + "Intrinsic called with incompatible signature", Call); if (Attrs.hasFnAttribute(Attribute::Speculatable)) { // Don't allow speculatable on call sites, unless the underlying function Index: llvm/test/Verifier/force-opaque-ptr.ll =================================================================== --- /dev/null +++ llvm/test/Verifier/force-opaque-ptr.ll @@ -0,0 +1,9 @@ +; RUN: not opt -passes=verify -force-opaque-pointers -S < %s 2>&1 | FileCheck %s + +declare i32 @llvm.umax.i32(i32, i32) + +define void @intrinsic_signature_mismatch() { +; CHECK: Intrinsic called with incompatible signature + call i32 @llvm.umax.i32(i32 0) + ret void +}