[llvm] [InstCombine] Fold shuffles through all trivially vectorizable intrinsics (PR #141979)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Fri May 30 04:21:49 PDT 2025
================
@@ -1401,26 +1401,25 @@ static Instruction *factorizeMinMaxTree(IntrinsicInst *II) {
/// try to shuffle after the intrinsic.
Instruction *
InstCombinerImpl::foldShuffledIntrinsicOperands(IntrinsicInst *II) {
- // TODO: This should be extended to handle other intrinsics like fshl, ctpop,
- // etc. Use llvm::isTriviallyVectorizable() and related to determine
- // which intrinsics are safe to shuffle?
- switch (II->getIntrinsicID()) {
- case Intrinsic::smax:
- case Intrinsic::smin:
- case Intrinsic::umax:
- case Intrinsic::umin:
- case Intrinsic::fma:
- case Intrinsic::fshl:
- case Intrinsic::fshr:
- break;
- default:
+ if (!isTriviallyVectorizable(II->getIntrinsicID()))
+ return nullptr;
+
+ assert(isSafeToSpeculativelyExecute(II) &&
----------------
dtcxzyw wrote:
I mean this assertion is not needed.
https://github.com/llvm/llvm-project/pull/141979
More information about the llvm-commits
mailing list