summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/Lint.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2014-03-06 17:33:55 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2014-03-06 17:33:55 +0000
commita236ea551ccf97911bb566850a09c1c72d412152 (patch)
treea4103d4ad4bdc6384e9a5246f58afd7cdbdd0036 /llvm/lib/Analysis/Lint.cpp
parent9c86656d62eedb7c88c16421680d2be23f72e3d6 (diff)
downloadbcm5719-llvm-a236ea551ccf97911bb566850a09c1c72d412152.tar.gz
bcm5719-llvm-a236ea551ccf97911bb566850a09c1c72d412152.zip
Teach lint about address spaces
llvm-svn: 203132
Diffstat (limited to 'llvm/lib/Analysis/Lint.cpp')
-rw-r--r--llvm/lib/Analysis/Lint.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/Analysis/Lint.cpp b/llvm/lib/Analysis/Lint.cpp
index 5c44638fbb0..b2182b146d7 100644
--- a/llvm/lib/Analysis/Lint.cpp
+++ b/llvm/lib/Analysis/Lint.cpp
@@ -16,7 +16,7 @@
// those aren't comprehensive either. Second, many conditions cannot be
// checked statically. This pass does no dynamic instrumentation, so it
// can't check for all possible problems.
-//
+//
// Another limitation is that it assumes all code will be executed. A store
// through a null pointer in a basic block which is never reached is harmless,
// but this pass will warn about it anyway. This is the main reason why most
@@ -26,12 +26,12 @@
// less obvious. If an optimization pass appears to be introducing a warning,
// it may be that the optimization pass is merely exposing an existing
// condition in the code.
-//
+//
// This code may be run before instcombine. In many cases, instcombine checks
// for the same kinds of things and turns instructions with undefined behavior
// into unreachable (or equivalent). Because of this, this pass makes some
// effort to look through bitcasts and so on.
-//
+//
//===----------------------------------------------------------------------===//
#include "llvm/Analysis/Lint.h"
@@ -652,8 +652,7 @@ Value *Lint::findValueImpl(Value *V, bool OffsetOk,
if (W != V)
return findValueImpl(W, OffsetOk, Visited);
} else if (CastInst *CI = dyn_cast<CastInst>(V)) {
- if (CI->isNoopCast(DL ? DL->getIntPtrType(V->getContext()) :
- Type::getInt64Ty(V->getContext())))
+ if (CI->isNoopCast(DL))
return findValueImpl(CI->getOperand(0), OffsetOk, Visited);
} else if (ExtractValueInst *Ex = dyn_cast<ExtractValueInst>(V)) {
if (Value *W = FindInsertedValue(Ex->getAggregateOperand(),
@@ -666,7 +665,7 @@ Value *Lint::findValueImpl(Value *V, bool OffsetOk,
if (CastInst::isNoopCast(Instruction::CastOps(CE->getOpcode()),
CE->getOperand(0)->getType(),
CE->getType(),
- DL ? DL->getIntPtrType(V->getContext()) :
+ DL ? DL->getIntPtrType(V->getType()) :
Type::getInt64Ty(V->getContext())))
return findValueImpl(CE->getOperand(0), OffsetOk, Visited);
} else if (CE->getOpcode() == Instruction::ExtractValue) {
OpenPOWER on IntegriCloud