aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/CodeGenPrepare.cpp
diff options
context:
space:
mode:
authorDavid Green <david.green@arm.com>2020-08-25 12:09:06 +0100
committerDavid Green <david.green@arm.com>2020-08-25 12:09:06 +0100
commit5b7e27a4db95a07cc140e3980a49a1ee3fb2052c (patch)
tree8d54d1a9f5f6126dff7401672840513fef404de7 /llvm/lib/CodeGen/CodeGenPrepare.cpp
parent1c39ffecd84a5eba54f5fabb433b0192d1dbd3b4 (diff)
downloadllvm-5b7e27a4db95a07cc140e3980a49a1ee3fb2052c.zip
llvm-5b7e27a4db95a07cc140e3980a49a1ee3fb2052c.tar.gz
llvm-5b7e27a4db95a07cc140e3980a49a1ee3fb2052c.tar.bz2
[ARM][CGP] Fix scalar condition selects for MVE
The arm backend does not handle select/select_cc on vectors with scalar conditions, preferring to expand them in codegenprepare instead. This usually works except when optimizing for size, where the optsize check would end up overruling the backend isSelectSupported check. We could handle the selects in ISel too, but this seems like smaller code than trying to splat the condition to all lanes. Differential Revision: https://reviews.llvm.org/D86433
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r--llvm/lib/CodeGen/CodeGenPrepare.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index a85ac80..86b5d20 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -6482,9 +6482,7 @@ bool CodeGenPrepare::optimizeFunnelShift(IntrinsicInst *Fsh) {
/// If we have a SelectInst that will likely profit from branch prediction,
/// turn it into a branch.
bool CodeGenPrepare::optimizeSelectInst(SelectInst *SI) {
- // If branch conversion isn't desirable, exit early.
- if (DisableSelectToBranch || OptSize ||
- llvm::shouldOptimizeForSize(SI->getParent(), PSI, BFI.get()))
+ if (DisableSelectToBranch)
return false;
// Find all consecutive select instructions that share the same condition.
@@ -6520,7 +6518,8 @@ bool CodeGenPrepare::optimizeSelectInst(SelectInst *SI) {
SelectKind = TargetLowering::ScalarValSelect;
if (TLI->isSelectSupported(SelectKind) &&
- !isFormingBranchFromSelectProfitable(TTI, TLI, SI))
+ (!isFormingBranchFromSelectProfitable(TTI, TLI, SI) || OptSize ||
+ llvm::shouldOptimizeForSize(SI->getParent(), PSI, BFI.get())))
return false;
// The DominatorTree needs to be rebuilt by any consumers after this