[llvm-commits] [llvm] r76280 - /llvm/trunk/lib/VMCore/Constants.cpp
Dan Gohman
gohman at apple.com
Fri Jul 17 18:49:22 PDT 2009
Author: djg
Date: Fri Jul 17 20:49:22 2009
New Revision: 76280
URL: http://llvm.org/viewvc/llvm-project?rev=76280&view=rev
Log:
Make GetElementPtr ConstantExprs default to having no pointer overflow.
Modified:
llvm/trunk/lib/VMCore/Constants.cpp
Modified: llvm/trunk/lib/VMCore/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=76280&r1=76279&r2=76280&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Constants.cpp (original)
+++ llvm/trunk/lib/VMCore/Constants.cpp Fri Jul 17 20:49:22 2009
@@ -18,6 +18,7 @@
#include "llvm/Instructions.h"
#include "llvm/MDNode.h"
#include "llvm/Module.h"
+#include "llvm/Operator.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringMap.h"
@@ -474,8 +475,11 @@
static GetElementPtrConstantExpr *Create(Constant *C,
const std::vector<Constant*>&IdxList,
const Type *DestTy) {
- return new(IdxList.size() + 1)
+ GetElementPtrConstantExpr *Result = new(IdxList.size() + 1)
GetElementPtrConstantExpr(C, IdxList, DestTy);
+ // Getelementptr defaults to having no pointer overflow.
+ cast<GEPOperator>(Result)->setHasNoPointerOverflow(true);
+ return Result;
}
/// Transparently provide more efficient getOperand methods.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
More information about the llvm-commits
mailing list