[llvm] 3ab00cf - [LV] Adjust code added in f79214d1 for 531dd3634 [nfc]
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 24 10:38:43 PDT 2022
Author: Philip Reames
Date: 2022-08-24T10:38:17-07:00
New Revision: 3ab00cfca9cf76840d178b7ab80631837886c176
URL: https://github.com/llvm/llvm-project/commit/3ab00cfca9cf76840d178b7ab80631837886c176
DIFF: https://github.com/llvm/llvm-project/commit/3ab00cfca9cf76840d178b7ab80631837886c176.diff
LOG: [LV] Adjust code added in f79214d1 for 531dd3634 [nfc]
When rebasing the review which became f79214d1, I forgot to adjust for the changed semantics introduced by 531dd3634. Functionally, this had no impact, but semantically it resulted in an incorrect result for isPredicatedInst. I noticed this while doing a follow up change.
Added:
Modified:
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index d098158fef5c..d706294dc73b 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -4433,6 +4433,15 @@ bool LoopVectorizationCostModel::isScalarWithPredication(
: !(isLegalMaskedStore(Ty, Ptr, Alignment) ||
TTI.isLegalMaskedScatter(VTy, Alignment));
}
+ case Instruction::UDiv:
+ case Instruction::SDiv:
+ case Instruction::SRem:
+ case Instruction::URem:
+ // We have the option to use the safe-divisor idiom to avoid predication.
+ // At the moment this is only used for scalable (which legally can't
+ // scalarize), but long term we want to make a cost based decision
+ // for fixed length vectors as well.
+ return !VF.isScalable();
}
}
@@ -4473,11 +4482,7 @@ bool LoopVectorizationCostModel::isPredicatedInst(Instruction *I,
case Instruction::URem:
// TODO: We can use the loop-preheader as context point here and get
// context sensitive reasoning
- // We have the option to use the safe-divisor idiom to avoid predication.
- // At the moment this is only used for scalable (which legally can't
- // scalarize), but long term we want to make a cost based decision
- // for fixed length vectors as well.
- return !VF.isScalable() && !isSafeToSpeculativelyExecute(I);
+ return !isSafeToSpeculativelyExecute(I);
}
}
More information about the llvm-commits
mailing list