Skip to content

Commit 76ba660

Browse files
authored
[InstCombine] Follow-up to "When -A + B both have nsw flag, set nsw f… (#72282)
…lag." In 3c037b7, Use cast instead of dyn_cast for cast that cannot fail.
1 parent e9e51da commit 76ba660

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1488,7 +1488,7 @@ Instruction *InstCombinerImpl::visitAdd(BinaryOperator &I) {
14881488

14891489
// -A + B --> B - A
14901490
auto *Sub = BinaryOperator::CreateSub(RHS, A);
1491-
auto *OB0 = dyn_cast<OverflowingBinaryOperator>(LHS);
1491+
auto *OB0 = cast<OverflowingBinaryOperator>(LHS);
14921492
Sub->setHasNoSignedWrap(I.hasNoSignedWrap() && OB0->hasNoSignedWrap());
14931493

14941494
return Sub;

0 commit comments

Comments
 (0)