From: Roman Lebedev Date: Sun, 22 Jan 2023 18:55:28 +0000 (+0300) Subject: [NFC][SCEV] `GetMinTrailingZerosImpl()`: deduplicate handling X-Git-Tag: upstream/17.0.6~20066 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=42aaab3b4545534e41da56961f9b62aa8af771c9;p=platform%2Fupstream%2Fllvm.git [NFC][SCEV] `GetMinTrailingZerosImpl()`: deduplicate handling `scPtrToInt` recieves same treatment as normal n-ary ops. --- diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index c7066a3..62097db 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -6336,8 +6336,6 @@ uint32_t ScalarEvolution::GetMinTrailingZerosImpl(const SCEV *S) { ? getTypeSizeInBits(E->getType()) : OpRes; } - case scPtrToInt: - return GetMinTrailingZeros(cast(S)->getOperand()); case scMulExpr: { const SCEVMulExpr *M = cast(S); // The result is the sum of all operands results. @@ -6351,6 +6349,7 @@ uint32_t ScalarEvolution::GetMinTrailingZerosImpl(const SCEV *S) { } case scUDivExpr: return 0; + case scPtrToInt: case scAddExpr: case scAddRecExpr: case scUMaxExpr: @@ -6359,10 +6358,10 @@ uint32_t ScalarEvolution::GetMinTrailingZerosImpl(const SCEV *S) { case scSMinExpr: case scSequentialUMinExpr: { // The result is the min of all operands results. - const SCEVNAryExpr *M = cast(S); - uint32_t MinOpRes = GetMinTrailingZeros(M->getOperand(0)); - for (unsigned I = 1, E = M->getNumOperands(); MinOpRes && I != E; ++I) - MinOpRes = std::min(MinOpRes, GetMinTrailingZeros(M->getOperand(I))); + ArrayRef Ops = S->operands(); + uint32_t MinOpRes = GetMinTrailingZeros(Ops[0]); + for (unsigned I = 1, E = Ops.size(); MinOpRes && I != E; ++I) + MinOpRes = std::min(MinOpRes, GetMinTrailingZeros(Ops[I])); return MinOpRes; } case scUnknown: {