These extra specializations were added in the depths of history (r67984 from
2009) and are clearly problematic now. The pointers actually are aligned to the
default (8 bytes), since otherwise UBsan would be complaining loudly.
I *think* it originally made sense because there was no "alignof" to infer the
correct value so the generic case went with what malloc returned (8-byte
aliged objects), and on 32-bit machines this specialization was correct. It
became wrong when we started compiling for 64-bit, and caused a UBSan failure
when we tried to put a ValueHandle into a DenseMap.
Should fix the Green Dragon UBSan bot.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289496
91177308-0d34-0410-b5e6-
96231b3b80d8
Instruction *cloneImpl() const;
};
-// Instruction* is only 4-byte aligned.
-template<>
-class PointerLikeTypeTraits<Instruction*> {
- typedef Instruction* PT;
-
-public:
- static inline void *getAsVoidPointer(PT P) { return P; }
-
- static inline PT getFromVoidPointer(void *P) {
- return static_cast<PT>(P);
- }
-
- enum { NumLowBitsAvailable = 2 };
-};
-
} // end namespace llvm
#endif // LLVM_IR_INSTRUCTION_H
class Use;
template <typename> struct simplify_type;
-// Use** is only 4-byte aligned.
-template <> class PointerLikeTypeTraits<Use **> {
-public:
- static inline void *getAsVoidPointer(Use **P) { return P; }
-
- static inline Use **getFromVoidPointer(void *P) {
- return static_cast<Use **>(P);
- }
-
- enum { NumLowBitsAvailable = 2 };
-};
-
/// \brief A Use represents the edge between a Value definition and its users.
///
/// This is notionally a two-dimensional linked list. It supports traversing
}
};
-// Value* is only 4-byte aligned.
-template<>
-class PointerLikeTypeTraits<Value*> {
- typedef Value* PT;
-
-public:
- static inline void *getAsVoidPointer(PT P) { return P; }
-
- static inline PT getFromVoidPointer(void *P) {
- return static_cast<PT>(P);
- }
-
- enum { NumLowBitsAvailable = 2 };
-};
-
// Create wrappers for C Binding types (see CBindingWrapping.h).
DEFINE_ISA_CONVERSION_FUNCTIONS(Value, LLVMValueRef)
class ValueHandleBase;
template<typename From> struct simplify_type;
-// ValueHandleBase** is only 4-byte aligned.
-template<>
-class PointerLikeTypeTraits<ValueHandleBase**> {
-public:
- static inline void *getAsVoidPointer(ValueHandleBase** P) { return P; }
- static inline ValueHandleBase **getFromVoidPointer(void *P) {
- return static_cast<ValueHandleBase**>(P);
- }
- enum { NumLowBitsAvailable = 2 };
-};
-
/// \brief This is the common base class of value handles.
///
/// ValueHandle's are smart pointers to Value's that have special behavior when