[llvm] [IndVars] Teach widenLoopCompare to use sext if narrow IV is positive and other operand is already sext. (PR #142703)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 4 09:57:05 PDT 2025
================
@@ -1630,6 +1630,12 @@ bool WidenIV::widenLoopCompare(WidenIV::NarrowIVDefUse DU) {
// Widen the other operand of the compare, if necessary.
if (CastWidth < IVWidth) {
+ // If the narrow IV is always postive and the other operand is sext, widen
----------------
topperc wrote:
We were never going to use zext for a slt/sgt/sle/sge compare. That's checked earlier when `CmpPreferredSign` was first calculated. I've only changed what happens for eq/ne/ult/ugt/ule/uge.
https://github.com/llvm/llvm-project/pull/142703
More information about the llvm-commits
mailing list