[PATCH] D87608: [ARM][MVE] Tail-predication: use unsigned SCEV ranges for tripcount
Sjoerd Meijer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 15 05:23:44 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG635b87511ec3: [ARM][MVE] Tail-predication: use unsigned SCEV ranges for tripcount (authored by SjoerdMeijer).
Changed prior to commit:
https://reviews.llvm.org/D87608?vs=291554&id=291872#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87608/new/
https://reviews.llvm.org/D87608
Files:
llvm/lib/Target/ARM/MVETailPredication.cpp
Index: llvm/lib/Target/ARM/MVETailPredication.cpp
===================================================================
--- llvm/lib/Target/ARM/MVETailPredication.cpp
+++ llvm/lib/Target/ARM/MVETailPredication.cpp
@@ -457,13 +457,10 @@
// upperbound(TC) <= UINT_MAX - VectorWidth
//
unsigned SizeInBits = TripCount->getType()->getScalarSizeInBits();
- auto Diff = APInt(SizeInBits, ~0) - APInt(SizeInBits, VectorWidth);
- uint64_t MaxMinusVW = Diff.getZExtValue();
- // FIXME: since ranges can be negative we work with signed ranges here, but
- // we shouldn't extract the zext'ed values for them.
- uint64_t UpperboundTC = SE->getSignedRange(TC).getUpper().getZExtValue();
+ auto MaxMinusVW = APInt(SizeInBits, ~0) - APInt(SizeInBits, VectorWidth);
+ APInt UpperboundTC = SE->getUnsignedRangeMax(TC);
- if (UpperboundTC > MaxMinusVW && !ForceTailPredication) {
+ if (UpperboundTC.ugt(MaxMinusVW) && !ForceTailPredication) {
LLVM_DEBUG(dbgs() << "ARM TP: Overflow possible in tripcount rounding:\n";
dbgs() << "upperbound(TC) <= UINT_MAX - VectorWidth\n";
dbgs() << UpperboundTC << " <= " << MaxMinusVW << " == false\n";);
@@ -501,8 +498,8 @@
auto *Ceil = SE->getUDivExpr(ECPlusVWMinus1,
SE->getSCEV(ConstantInt::get(TripCount->getType(), VectorWidth)));
- ConstantRange RangeCeil = SE->getSignedRange(Ceil) ;
- ConstantRange RangeTC = SE->getSignedRange(TC) ;
+ ConstantRange RangeCeil = SE->getUnsignedRange(Ceil) ;
+ ConstantRange RangeTC = SE->getUnsignedRange(TC) ;
if (!RangeTC.isSingleElement()) {
auto ZeroRange =
ConstantRange(APInt(TripCount->getType()->getScalarSizeInBits(), 0));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87608.291872.patch
Type: text/x-patch
Size: 1684 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200915/6a378700/attachment.bin>
More information about the llvm-commits
mailing list