[llvm] [InstCombine] Follow-up to "When -A + B both have nsw flag, set nsw f… (PR #72282)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 14 08:35:28 PST 2023
https://github.com/Z572 created https://github.com/llvm/llvm-project/pull/72282
…lag."
In 3c037b7306f57039e24a1470687cc39a795584ac, I've miss suggested about cast.
>From 15d9d483f9b8c5cced7ead987ba55a369651a76a Mon Sep 17 00:00:00 2001
From: Zheng Junjie <zhengjunjie at iscas.ac.cn>
Date: Wed, 15 Nov 2023 00:30:04 +0800
Subject: [PATCH] [InstCombine] Follow-up to "When -A + B both have nsw flag,
set nsw flag."
In 3c037b7306f57039e24a1470687cc39a795584ac, I've miss suggested about cast.
---
llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
index d390d3a581fcaa2..2bd738c95ecaa7f 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
@@ -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;
More information about the llvm-commits
mailing list