[llvm] [InstCombine] Propagate exact flags in shift-combine transforms (PR #88340)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 14 19:51:44 PDT 2024
================
@@ -1398,8 +1398,12 @@ Instruction *InstCombinerImpl::visitLShr(BinaryOperator &I) {
if (match(Op0, m_LShr(m_Value(X), m_APInt(C1)))) {
// Oversized shifts are simplified to zero in InstSimplify.
unsigned AmtSum = ShAmtC + C1->getZExtValue();
- if (AmtSum < BitWidth)
- return BinaryOperator::CreateLShr(X, ConstantInt::get(Ty, AmtSum));
+ if (AmtSum < BitWidth) {
+ auto *NewLShr =
+ BinaryOperator::CreateLShr(X, ConstantInt::get(Ty, AmtSum));
+ NewLShr->setIsExact(I.isExact() && cast<Instruction>(Op0)->isExact());
+ return NewLShr;
+ }
----------------
nikic wrote:
Looks like this is not resolved?
https://github.com/llvm/llvm-project/pull/88340
More information about the llvm-commits
mailing list