summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-07-17 19:23:21 +0000
committerDan Gohman <gohman@apple.com>2009-07-17 19:23:21 +0000
commit97190a2c9389abef09fdd6eaad763dba4f02f0a4 (patch)
tree39fb2e111ab65082960d4bcec9f5e22a20512307
parent64c6d42a9a1c7c78b2f6a6ec761a8afc2cd5c339 (diff)
downloadbcm5719-llvm-97190a2c9389abef09fdd6eaad763dba4f02f0a4.tar.gz
bcm5719-llvm-97190a2c9389abef09fdd6eaad763dba4f02f0a4.zip
GetElementPtr instructions default to having no overflow.
llvm-svn: 76222
-rw-r--r--llvm/lib/VMCore/Instructions.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Instructions.cpp b/llvm/lib/VMCore/Instructions.cpp
index 6a259fb9251..a5e082c2377 100644
--- a/llvm/lib/VMCore/Instructions.cpp
+++ b/llvm/lib/VMCore/Instructions.cpp
@@ -1022,6 +1022,9 @@ void GetElementPtrInst::init(Value *Ptr, Value* const *Idx, unsigned NumIdx,
OL[i+1] = Idx[i];
setName(Name);
+
+ // GetElementPtr instructions have undefined results on overflow by default.
+ setHasNoPointerOverflow(true);
}
void GetElementPtrInst::init(Value *Ptr, Value *Idx, const std::string &Name) {
@@ -1031,6 +1034,9 @@ void GetElementPtrInst::init(Value *Ptr, Value *Idx, const std::string &Name) {
OL[1] = Idx;
setName(Name);
+
+ // GetElementPtr instructions have undefined results on overflow by default.
+ setHasNoPointerOverflow(true);
}
GetElementPtrInst::GetElementPtrInst(const GetElementPtrInst &GEPI)
@@ -1042,6 +1048,9 @@ GetElementPtrInst::GetElementPtrInst(const GetElementPtrInst &GEPI)
Use *GEPIOL = GEPI.OperandList;
for (unsigned i = 0, E = NumOperands; i != E; ++i)
OL[i] = GEPIOL[i];
+
+ // Transfor the hasNoPointerOverflow() value from the original GEPI.
+ setHasNoPointerOverflow(GEPI.hasNoPointerOverflow());
}
GetElementPtrInst::GetElementPtrInst(Value *Ptr, Value *Idx,
OpenPOWER on IntegriCloud