[llvm] b5c4456 - [InstCombine] Remove redundant folds in foldCastedBitwiseLogic() (NFCI)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 24 08:07:25 PDT 2023
Author: Nikita Popov
Date: 2023-10-24T17:06:39+02:00
New Revision: b5c44564e55e93321e224937b817a40d69de59fd
URL: https://github.com/llvm/llvm-project/commit/b5c44564e55e93321e224937b817a40d69de59fd
DIFF: https://github.com/llvm/llvm-project/commit/b5c44564e55e93321e224937b817a40d69de59fd.diff
LOG: [InstCombine] Remove redundant folds in foldCastedBitwiseLogic() (NFCI)
The vector sext limitation the comment talks about has been removed
a long time ago, in https://reviews.llvm.org/D36213.
Added:
Modified:
llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
index cedd8f47fe651f2..42734c42750f30e 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
@@ -1765,29 +1765,6 @@ Instruction *InstCombinerImpl::foldCastedBitwiseLogic(BinaryOperator &I) {
return CastInst::Create(CastOpcode, NewOp, DestTy);
}
- // For now, only 'and'/'or' have optimizations after this.
- if (LogicOpc == Instruction::Xor)
- return nullptr;
-
- // If this is logic(cast(icmp), cast(icmp)), try to fold this even if the
- // cast is otherwise not optimizable. This happens for vector sexts.
- ICmpInst *ICmp0 = dyn_cast<ICmpInst>(Cast0Src);
- ICmpInst *ICmp1 = dyn_cast<ICmpInst>(Cast1Src);
- if (ICmp0 && ICmp1) {
- if (Value *Res =
- foldAndOrOfICmps(ICmp0, ICmp1, I, LogicOpc == Instruction::And))
- return CastInst::Create(CastOpcode, Res, DestTy);
- return nullptr;
- }
-
- // If this is logic(cast(fcmp), cast(fcmp)), try to fold this even if the
- // cast is otherwise not optimizable. This happens for vector sexts.
- FCmpInst *FCmp0 = dyn_cast<FCmpInst>(Cast0Src);
- FCmpInst *FCmp1 = dyn_cast<FCmpInst>(Cast1Src);
- if (FCmp0 && FCmp1)
- if (Value *R = foldLogicOfFCmps(FCmp0, FCmp1, LogicOpc == Instruction::And))
- return CastInst::Create(CastOpcode, R, DestTy);
-
return nullptr;
}
More information about the llvm-commits
mailing list