Skip to content

Commit

Permalink
[InstCombine] Follow-up to "When -A + B both have nsw flag, set nsw f… (
Browse files Browse the repository at this point in the history
#72282)

…lag."

In 3c037b7, Use cast instead of dyn_cast for cast that cannot fail.
  • Loading branch information
Z572 committed Nov 14, 2023
1 parent e9e51da commit 76ba660
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1488,7 +1488,7 @@ Instruction *InstCombinerImpl::visitAdd(BinaryOperator &I) {

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

return Sub;
Expand Down

0 comments on commit 76ba660

Please sign in to comment.