From 7b9486ad4355a010d22e0737cee9cd7c7b747ece Mon Sep 17 00:00:00 2001 From: Dale Johannesen Date: Wed, 13 May 2009 00:24:22 +0000 Subject: Add an int64_t variant of abs, for host environments without one. Use it where we were using abs on int64_t objects. (I strongly suspect the casts to unsigned in the fragments in LoopStrengthReduce are not doing whatever the original intent was, but the obvious change to uint64_t doesn't work. Maybe later.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71612 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/LoopStrengthReduce.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/Transforms/Scalar/LoopStrengthReduce.cpp') diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 4f6d53179e..ed12d8683d 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -1013,7 +1013,7 @@ SCEVHandle LoopStrengthReduce::CheckForIVReuse(bool HasBaseReg, continue; int64_t SSInt = cast(SI->first)->getValue()->getSExtValue(); if (SI->first != Stride && - (unsigned(abs(SInt)) < SSInt || (SInt % SSInt) != 0)) + (unsigned(abs64(SInt)) < SSInt || (SInt % SSInt) != 0)) continue; int64_t Scale = SInt / SSInt; // Check that this stride is valid for all the types used for loads and @@ -1900,7 +1900,7 @@ ICmpInst *LoopStrengthReduce::ChangeCompareStride(Loop *L, ICmpInst *Cond, continue; int64_t SSInt = cast(SI->first)->getValue()->getSExtValue(); if (SSInt == CmpSSInt || - abs(SSInt) < abs(CmpSSInt) || + abs64(SSInt) < abs64(CmpSSInt) || (SSInt % CmpSSInt) != 0) continue; @@ -2336,7 +2336,7 @@ void LoopStrengthReduce::OptimizeLoopTermCond(Loop *L) { cast(SI->first)->getValue()->getSExtValue(); if (SSInt == SInt) return; // This can definitely be reused. - if (unsigned(abs(SSInt)) < SInt || (SSInt % SInt) != 0) + if (unsigned(abs64(SSInt)) < SInt || (SSInt % SInt) != 0) continue; int64_t Scale = SSInt / SInt; bool AllUsesAreAddresses = true; -- cgit v1.2.3-70-g09d2