[llvm] bd341ba - [NFC] Simplify code in IndVars
Max Kazantsev via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 30 03:50:05 PDT 2020
Author: Max Kazantsev
Date: 2020-10-30T17:49:32+07:00
New Revision: bd341bafbf60be1b9b9cc12ec2c5c37c2ea0e46b
URL: https://github.com/llvm/llvm-project/commit/bd341bafbf60be1b9b9cc12ec2c5c37c2ea0e46b
DIFF: https://github.com/llvm/llvm-project/commit/bd341bafbf60be1b9b9cc12ec2c5c37c2ea0e46b.diff
LOG: [NFC] Simplify code in IndVars
Added:
Modified:
llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
index 729173df6355..2a5d1da6717d 100644
--- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -1132,18 +1132,14 @@ bool WidenIV::widenWithVariantUse(NarrowIVDefUse DU) {
if (!AddRecOp1 || AddRecOp1->getLoop() != L)
return false;
- if (ExtKind == SignExtended) {
- for (Use &U : NarrowUse->uses()) {
- SExtInst *User = dyn_cast<SExtInst>(U.getUser());
- if (!User || User->getType() != WideType)
- return false;
- }
- } else { // ExtKind == ZeroExtended
- for (Use &U : NarrowUse->uses()) {
- ZExtInst *User = dyn_cast<ZExtInst>(U.getUser());
- if (!User || User->getType() != WideType)
- return false;
- }
+ for (Use &U : NarrowUse->uses()) {
+ Instruction *User = nullptr;
+ if (ExtKind == SignExtended)
+ User = dyn_cast<SExtInst>(U.getUser());
+ else
+ User = dyn_cast<ZExtInst>(U.getUser());
+ if (!User || User->getType() != WideType)
+ return false;
}
LLVM_DEBUG(dbgs() << "Cloning arithmetic IVUser: " << *NarrowUse << "\n");
More information about the llvm-commits
mailing list