[llvm] 430b90f - [nsan][NFC] Use cast when dyn_cast is not needed. (#101147)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 31 20:23:07 PDT 2024
Author: Wu Yingcong
Date: 2024-08-01T11:23:03+08:00
New Revision: 430b90f04533b099d788db2668176038be38c53b
URL: https://github.com/llvm/llvm-project/commit/430b90f04533b099d788db2668176038be38c53b
DIFF: https://github.com/llvm/llvm-project/commit/430b90f04533b099d788db2668176038be38c53b.diff
LOG: [nsan][NFC] Use cast when dyn_cast is not needed. (#101147)
Use `cast` instead to replace `dyn_cast` when `dyn_cast` is not
needed/not checked.
Added:
Modified:
llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp
index 832506f639a74..5872396669435 100644
--- a/llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp
@@ -1715,7 +1715,7 @@ Value *NumericalStabilitySanitizer::createShadowValueWithOperandsAvailable(
Map.getShadow(BinOp->getOperand(1)));
if (isa<UIToFPInst>(&Inst) || isa<SIToFPInst>(&Inst)) {
- auto *Cast = dyn_cast<CastInst>(&Inst);
+ auto *Cast = cast<CastInst>(&Inst);
return Builder.CreateCast(Cast->getOpcode(), Cast->getOperand(0),
ExtendedVT);
}
@@ -2168,7 +2168,7 @@ bool NumericalStabilitySanitizer::sanitizeFunction(
// The last pass populates shadow phis with shadow values.
for (PHINode *Phi : OriginalPhis) {
- PHINode *ShadowPhi = dyn_cast<PHINode>(ValueToShadow.getShadow(Phi));
+ PHINode *ShadowPhi = cast<PHINode>(ValueToShadow.getShadow(Phi));
for (unsigned I : seq(Phi->getNumOperands())) {
Value *V = Phi->getOperand(I);
Value *Shadow = ValueToShadow.getShadow(V);
More information about the llvm-commits
mailing list