Skip to content

Commit 430b90f

Browse files
authored
[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.
1 parent ed12f80 commit 430b90f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1715,7 +1715,7 @@ Value *NumericalStabilitySanitizer::createShadowValueWithOperandsAvailable(
17151715
Map.getShadow(BinOp->getOperand(1)));
17161716

17171717
if (isa<UIToFPInst>(&Inst) || isa<SIToFPInst>(&Inst)) {
1718-
auto *Cast = dyn_cast<CastInst>(&Inst);
1718+
auto *Cast = cast<CastInst>(&Inst);
17191719
return Builder.CreateCast(Cast->getOpcode(), Cast->getOperand(0),
17201720
ExtendedVT);
17211721
}
@@ -2168,7 +2168,7 @@ bool NumericalStabilitySanitizer::sanitizeFunction(
21682168

21692169
// The last pass populates shadow phis with shadow values.
21702170
for (PHINode *Phi : OriginalPhis) {
2171-
PHINode *ShadowPhi = dyn_cast<PHINode>(ValueToShadow.getShadow(Phi));
2171+
PHINode *ShadowPhi = cast<PHINode>(ValueToShadow.getShadow(Phi));
21722172
for (unsigned I : seq(Phi->getNumOperands())) {
21732173
Value *V = Phi->getOperand(I);
21742174
Value *Shadow = ValueToShadow.getShadow(V);

0 commit comments

Comments
 (0)