[llvm] [VPlan] Mark Scalar instruction as not predicated (PR #95191)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 12 18:52:22 PDT 2024
https://github.com/eastB233 updated https://github.com/llvm/llvm-project/pull/95191
>From 6db180353c40ab1b716cece50dd577ce8cf1bc93 Mon Sep 17 00:00:00 2001
From: Zhiheng Xie <eastb233 at qq.com>
Date: Thu, 13 Jun 2024 09:50:28 +0800
Subject: [PATCH] [VPlan] Treat Div/Rem as not Predicated if divisor is
invariant
Fixes https://github.com/llvm/llvm-project/issues/94328
---
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index c7c19ef456c7c..2d8891b8a1794 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -3863,7 +3863,8 @@ bool LoopVectorizationCostModel::isPredicatedInst(Instruction *I) const {
case Instruction::URem:
// TODO: We can use the loop-preheader as context point here and get
// context sensitive reasoning
- return !isSafeToSpeculativelyExecute(I);
+ return !isSafeToSpeculativelyExecute(I) &&
+ !Legal->isInvariant(I->getOperand(1));
case Instruction::Call:
return Legal->isMaskRequired(I);
}
More information about the llvm-commits
mailing list