aboutsummaryrefslogtreecommitdiff
path: root/lib
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
commit1bd9f58d6dd26ad8085e90a753d0a9aa76fb15e3 (patch)
tree4ad924f76682524d864db30380bb4be55ed32d52 /lib
parent6215c6227e788c7c13d5d83d469e5b0019a0f1af (diff)
GetElementPtr instructions default to having no overflow.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76222 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/VMCore/Instructions.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index 6a259fb925..a5e082c237 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/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,