From 846a2f2703f6bb894098274964faf5dce0b68c4d Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 27 Aug 2009 17:51:25 +0000 Subject: [PATCH] Handle TargetData with const. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80262 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/ValueTracking.h | 6 +++--- lib/Analysis/ValueTracking.cpp | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/include/llvm/Analysis/ValueTracking.h b/include/llvm/Analysis/ValueTracking.h index 1ebd9c26c4a..6bb3b3c98e8 100644 --- a/include/llvm/Analysis/ValueTracking.h +++ b/include/llvm/Analysis/ValueTracking.h @@ -30,14 +30,14 @@ namespace llvm { /// bit sets. This code only analyzes bits in Mask, in order to short-circuit /// processing. void ComputeMaskedBits(Value *V, const APInt &Mask, APInt &KnownZero, - APInt &KnownOne, TargetData *TD = 0, + APInt &KnownOne, const TargetData *TD = 0, unsigned Depth = 0); /// MaskedValueIsZero - Return true if 'V & Mask' is known to be zero. We use /// this predicate to simplify operations downstream. Mask is known to be /// zero for bits that V cannot have. bool MaskedValueIsZero(Value *V, const APInt &Mask, - TargetData *TD = 0, unsigned Depth = 0); + const TargetData *TD = 0, unsigned Depth = 0); /// ComputeNumSignBits - Return the number of times the sign bit of the @@ -48,7 +48,7 @@ namespace llvm { /// /// 'Op' must have a scalar integer type. /// - unsigned ComputeNumSignBits(Value *Op, TargetData *TD = 0, + unsigned ComputeNumSignBits(Value *Op, const TargetData *TD = 0, unsigned Depth = 0); /// CannotBeNegativeZero - Return true if we can prove that the specified FP diff --git a/lib/Analysis/ValueTracking.cpp b/lib/Analysis/ValueTracking.cpp index 2042d2e0a1e..cb2d624a909 100644 --- a/lib/Analysis/ValueTracking.cpp +++ b/lib/Analysis/ValueTracking.cpp @@ -37,7 +37,7 @@ using namespace llvm; /// this won't lose us code quality. void llvm::ComputeMaskedBits(Value *V, const APInt &Mask, APInt &KnownZero, APInt &KnownOne, - TargetData *TD, unsigned Depth) { + const TargetData *TD, unsigned Depth) { const unsigned MaxDepth = 6; assert(V && "No Value?"); assert(Depth <= MaxDepth && "Limit Search Depth"); @@ -609,7 +609,7 @@ void llvm::ComputeMaskedBits(Value *V, const APInt &Mask, /// this predicate to simplify operations downstream. Mask is known to be zero /// for bits that V cannot have. bool llvm::MaskedValueIsZero(Value *V, const APInt &Mask, - TargetData *TD, unsigned Depth) { + const TargetData *TD, unsigned Depth) { APInt KnownZero(Mask.getBitWidth(), 0), KnownOne(Mask.getBitWidth(), 0); ComputeMaskedBits(V, Mask, KnownZero, KnownOne, TD, Depth); assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); @@ -626,7 +626,8 @@ bool llvm::MaskedValueIsZero(Value *V, const APInt &Mask, /// /// 'Op' must have a scalar integer type. /// -unsigned llvm::ComputeNumSignBits(Value *V, TargetData *TD, unsigned Depth) { +unsigned llvm::ComputeNumSignBits(Value *V, const TargetData *TD, + unsigned Depth) { assert((TD || V->getType()->isIntOrIntVector()) && "ComputeNumSignBits requires a TargetData object to operate " "on non-integer values!");