[llvm] r372733 - [IR] IntrinsicInst - silence static analyzer dyn_cast<> null dereference warnings. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 24 04:40:46 PDT 2019
Author: rksimon
Date: Tue Sep 24 04:40:45 2019
New Revision: 372733
URL: http://llvm.org/viewvc/llvm-project?rev=372733&view=rev
Log:
[IR] IntrinsicInst - silence static analyzer dyn_cast<> null dereference warnings. NFCI.
The static analyzer is warning about a potential null dereference, but we should be able to use cast<> directly and if not assert will fire for us.
Modified:
llvm/trunk/lib/IR/IntrinsicInst.cpp
Modified: llvm/trunk/lib/IR/IntrinsicInst.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/IntrinsicInst.cpp?rev=372733&r1=372732&r2=372733&view=diff
==============================================================================
--- llvm/trunk/lib/IR/IntrinsicInst.cpp (original)
+++ llvm/trunk/lib/IR/IntrinsicInst.cpp Tue Sep 24 04:40:45 2019
@@ -107,7 +107,7 @@ Optional<ConstrainedFPIntrinsic::Roundin
ConstrainedFPIntrinsic::getRoundingMode() const {
unsigned NumOperands = getNumArgOperands();
Metadata *MD =
- dyn_cast<MetadataAsValue>(getArgOperand(NumOperands - 2))->getMetadata();
+ cast<MetadataAsValue>(getArgOperand(NumOperands - 2))->getMetadata();
if (!MD || !isa<MDString>(MD))
return None;
return StrToRoundingMode(cast<MDString>(MD)->getString());
@@ -153,7 +153,7 @@ Optional<ConstrainedFPIntrinsic::Excepti
ConstrainedFPIntrinsic::getExceptionBehavior() const {
unsigned NumOperands = getNumArgOperands();
Metadata *MD =
- dyn_cast<MetadataAsValue>(getArgOperand(NumOperands - 1))->getMetadata();
+ cast<MetadataAsValue>(getArgOperand(NumOperands - 1))->getMetadata();
if (!MD || !isa<MDString>(MD))
return None;
return StrToExceptionBehavior(cast<MDString>(MD)->getString());
More information about the llvm-commits
mailing list