[llvm] [indvars] Allow widenWithVariantUse to succeed without extend users (PR #71557)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 7 08:37:49 PST 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 75d6795e420274346b14aca8b6bd49bfe6030eeb 616ab41a7a325a8c6160abae2e09ade94d0e41ad -- llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
index 37735a0442ce..006dcd8339a6 100644
--- a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
@@ -1617,8 +1617,8 @@ bool WidenIV::widenWithVariantUse(WidenIV::NarrowIVDefUse DU) {
const Instruction *CtxI = findCommonDominator(ExtUsers, *DT);
if (!CanSignExtend && !CanZeroExtend) {
- // Because InstCombine turns 'sub nuw' to 'add' losing the no-wrap flag, we
- // will most likely not see it. Let's try to prove it.
+ // Because InstCombine turns 'sub nuw' to 'add' losing the no-wrap flag,
+ // we will most likely not see it. Let's try to prove it.
if (OpCode != Instruction::Add)
return false;
if (ExtKind != ExtendKind::Zero)
@@ -1630,12 +1630,12 @@ bool WidenIV::widenWithVariantUse(WidenIV::NarrowIVDefUse DU) {
return false;
if (!SE->isKnownNegative(RHS))
return false;
- bool ProvedSubNUW = SE->isKnownPredicateAt(ICmpInst::ICMP_UGE, LHS,
- SE->getNegativeSCEV(RHS), CtxI);
+ bool ProvedSubNUW = SE->isKnownPredicateAt(
+ ICmpInst::ICMP_UGE, LHS, SE->getNegativeSCEV(RHS), CtxI);
if (!ProvedSubNUW)
return false;
- // In fact, our 'add' is 'sub nuw'. We will need to widen the 2nd operand as
- // neg(zext(neg(op))), which is basically sext(op).
+ // In fact, our 'add' is 'sub nuw'. We will need to widen the 2nd operand
+ // as neg(zext(neg(op))), which is basically sext(op).
AnotherOpExtKind = ExtendKind::Sign;
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/71557
More information about the llvm-commits
mailing list