aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-11-01 08:07:29 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-11-01 08:07:29 +0000
commitece6c6bb6329748b92403c06ac87f45c43485911 (patch)
tree6db9d3586fbfc4b362af63c5d5b5a5498fb569e0 /include
parent86ccc55c82651f91fd6a312c5f6a4b511bcd1aec (diff)
downloadexternal_llvm-ece6c6bb6329748b92403c06ac87f45c43485911.zip
external_llvm-ece6c6bb6329748b92403c06ac87f45c43485911.tar.gz
external_llvm-ece6c6bb6329748b92403c06ac87f45c43485911.tar.bz2
Revert the series of commits starting with r166578 which introduced the
getIntPtrType support for multiple address spaces via a pointer type, and also introduced a crasher bug in the constant folder reported in PR14233. These commits also contained several problems that should really be addressed before they are re-committed. I have avoided reverting various cleanups to the DataLayout APIs that are reasonable to have moving forward in order to reduce the amount of churn, and minimize the number of commits that were reverted. I've also manually updated merge conflicts and manually arranged for the getIntPtrType function to stay in DataLayout and to be defined in a plausible way after this revert. Thanks to Duncan for working through this exact strategy with me, and Nick Lewycky for tracking down the really annoying crasher this triggered. (Test case to follow in its own commit.) After discussing with Duncan extensively, and based on a note from Micah, I'm going to continue to back out some more of the more problematic patches in this series in order to ensure we go into the LLVM 3.2 branch with a reasonable story here. I'll send a note to llvmdev explaining what's going on and why. Summary of reverted revisions: r166634: Fix a compiler warning with an unused variable. r166607: Add some cleanup to the DataLayout changes requested by Chandler. r166596: Revert "Back out r166591, not sure why this made it through since I cancelled the command. Bleh, sorry about this! r166591: Delete a directory that wasn't supposed to be checked in yet. r166578: Add in support for getIntPtrType to get the pointer type based on the address space. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167221 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Analysis/MemoryBuiltins.h5
-rw-r--r--include/llvm/Analysis/ScalarEvolution.h5
-rw-r--r--include/llvm/DataLayout.h10
-rw-r--r--include/llvm/InstrTypes.h6
-rw-r--r--include/llvm/Transforms/Utils/Local.h4
5 files changed, 7 insertions, 23 deletions
diff --git a/include/llvm/Analysis/MemoryBuiltins.h b/include/llvm/Analysis/MemoryBuiltins.h
index 9e5d97d..a842898 100644
--- a/include/llvm/Analysis/MemoryBuiltins.h
+++ b/include/llvm/Analysis/MemoryBuiltins.h
@@ -168,8 +168,7 @@ class ObjectSizeOffsetVisitor
public:
ObjectSizeOffsetVisitor(const DataLayout *TD, const TargetLibraryInfo *TLI,
- LLVMContext &Context, bool RoundToAlign = false,
- unsigned AS = 0);
+ LLVMContext &Context, bool RoundToAlign = false);
SizeOffsetType compute(Value *V);
@@ -230,7 +229,7 @@ class ObjectSizeOffsetEvaluator
public:
ObjectSizeOffsetEvaluator(const DataLayout *TD, const TargetLibraryInfo *TLI,
- LLVMContext &Context, unsigned AS = 0);
+ LLVMContext &Context);
SizeOffsetEvalType compute(Value *V);
bool knownSize(SizeOffsetEvalType SizeOffset) {
diff --git a/include/llvm/Analysis/ScalarEvolution.h b/include/llvm/Analysis/ScalarEvolution.h
index b5025d3..235adca 100644
--- a/include/llvm/Analysis/ScalarEvolution.h
+++ b/include/llvm/Analysis/ScalarEvolution.h
@@ -628,7 +628,7 @@ namespace llvm {
/// getSizeOfExpr - Return an expression for sizeof on the given type.
///
- const SCEV *getSizeOfExpr(Type *AllocTy, Type *IntPtrTy);
+ const SCEV *getSizeOfExpr(Type *AllocTy);
/// getAlignOfExpr - Return an expression for alignof on the given type.
///
@@ -636,8 +636,7 @@ namespace llvm {
/// getOffsetOfExpr - Return an expression for offsetof on the given field.
///
- const SCEV *getOffsetOfExpr(StructType *STy, Type *IntPtrTy,
- unsigned FieldNo);
+ const SCEV *getOffsetOfExpr(StructType *STy, unsigned FieldNo);
/// getOffsetOfExpr - Return an expression for offsetof on the given field.
///
diff --git a/include/llvm/DataLayout.h b/include/llvm/DataLayout.h
index 987569d..e9d8678 100644
--- a/include/llvm/DataLayout.h
+++ b/include/llvm/DataLayout.h
@@ -258,14 +258,6 @@ public:
unsigned getPointerSizeInBits(unsigned AS) const {
return getPointerSize(AS) * 8;
}
- /// Layout pointer size, in bits, based on the type.
- /// If this function is called with a pointer type, then
- /// the type size of the pointer is returned.
- /// If this function is called with a vector of pointers,
- /// then the type size of the pointer is returned.
- /// Otherwise the type sizeo f a default pointer is returned.
- unsigned getPointerTypeSizeInBits(Type* Ty) const;
-
/// Size examples:
///
/// Type SizeInBits StoreSizeInBits AllocSizeInBits[*]
@@ -343,7 +335,7 @@ public:
/// getIntPtrType - Return an integer type with size at least as big as that
/// of a pointer in the given address space.
- IntegerType *getIntPtrType(LLVMContext &C, unsigned AddressSpace) const;
+ IntegerType *getIntPtrType(LLVMContext &C, unsigned AddressSpace = 0) const;
/// getIntPtrType - Return an integer (vector of integer) type with size at
/// least as big as that of a pointer of the given pointer (vector of pointer)
diff --git a/include/llvm/InstrTypes.h b/include/llvm/InstrTypes.h
index 74e51ff..da17f3b 100644
--- a/include/llvm/InstrTypes.h
+++ b/include/llvm/InstrTypes.h
@@ -17,7 +17,6 @@
#define LLVM_INSTRUCTION_TYPES_H
#include "llvm/Instruction.h"
-#include "llvm/DataLayout.h"
#include "llvm/OperandTraits.h"
#include "llvm/DerivedTypes.h"
#include "llvm/ADT/Twine.h"
@@ -577,11 +576,6 @@ public:
Type *IntPtrTy ///< Integer type corresponding to pointer
) const;
- /// @brief Determine if this cast is a no-op cast.
- bool isNoopCast(
- const DataLayout &DL ///< DataLayout to get the Int Ptr type from.
- ) const;
-
/// Determine how a pair of casts can be eliminated, if they can be at all.
/// This is a helper function for both CastInst and ConstantExpr.
/// @returns 0 if the CastInst pair can't be eliminated, otherwise
diff --git a/include/llvm/Transforms/Utils/Local.h b/include/llvm/Transforms/Utils/Local.h
index 5c804d8..7173781 100644
--- a/include/llvm/Transforms/Utils/Local.h
+++ b/include/llvm/Transforms/Utils/Local.h
@@ -179,9 +179,8 @@ static inline unsigned getKnownAlignment(Value *V, const DataLayout *TD = 0) {
template<typename IRBuilderTy>
Value *EmitGEPOffset(IRBuilderTy *Builder, const DataLayout &TD, User *GEP,
bool NoAssumptions = false) {
- unsigned AS = cast<GEPOperator>(GEP)->getPointerAddressSpace();
gep_type_iterator GTI = gep_type_begin(GEP);
- Type *IntPtrTy = TD.getIntPtrType(GEP->getContext(), AS);
+ Type *IntPtrTy = TD.getIntPtrType(GEP->getContext());
Value *Result = Constant::getNullValue(IntPtrTy);
// If the GEP is inbounds, we know that none of the addressing operations will
@@ -189,6 +188,7 @@ Value *EmitGEPOffset(IRBuilderTy *Builder, const DataLayout &TD, User *GEP,
bool isInBounds = cast<GEPOperator>(GEP)->isInBounds() && !NoAssumptions;
// Build a mask for high order bits.
+ unsigned AS = cast<GEPOperator>(GEP)->getPointerAddressSpace();
unsigned IntPtrWidth = TD.getPointerSizeInBits(AS);
uint64_t PtrSizeMask = ~0ULL >> (64-IntPtrWidth);