diff --git a/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def b/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def index 2139b9e3cddfd..c4218326280b2 100644 --- a/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def +++ b/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def @@ -26,10 +26,7 @@ #endif #define __OMP_TYPE(VarName) OMP_TYPE(VarName, Type::get##VarName##Ty(Ctx)) -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY #define __OMP_PTR_TYPE(VarName) OMP_TYPE(VarName, PointerType::get(Ctx, 0)) -#else -#endif __OMP_TYPE(Void) __OMP_TYPE(Int1) @@ -37,39 +34,21 @@ __OMP_TYPE(Int8) __OMP_TYPE(Int16) __OMP_TYPE(Int32) __OMP_TYPE(Int64) -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY __OMP_PTR_TYPE(Int8Ptr) __OMP_PTR_TYPE(Int16Ptr) __OMP_PTR_TYPE(Int32Ptr) __OMP_PTR_TYPE(Int64Ptr) -#else -__OMP_TYPE(Int8Ptr) -__OMP_TYPE(Int16Ptr) -__OMP_TYPE(Int32Ptr) -__OMP_TYPE(Int64Ptr) -#endif __OMP_TYPE(Double) OMP_TYPE(SizeTy, M.getDataLayout().getIntPtrType(Ctx)) OMP_TYPE(Int63, Type::getIntNTy(Ctx, 63)) -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY __OMP_PTR_TYPE(VoidPtr) __OMP_PTR_TYPE(VoidPtrPtr) __OMP_PTR_TYPE(VoidPtrPtrPtr) __OMP_PTR_TYPE(Int8PtrPtr) __OMP_PTR_TYPE(Int8PtrPtrPtr) -#else -#define __OMP_PTR_TYPE(NAME, BASE) OMP_TYPE(NAME, BASE->getPointerTo()) - -__OMP_PTR_TYPE(VoidPtr, Int8) -__OMP_PTR_TYPE(VoidPtrPtr, VoidPtr) -__OMP_PTR_TYPE(VoidPtrPtrPtr, VoidPtrPtr) - -__OMP_PTR_TYPE(Int8PtrPtr, Int8Ptr) -__OMP_PTR_TYPE(Int8PtrPtrPtr, Int8PtrPtr) -#endif #undef __OMP_PTR_TYPE diff --git a/llvm/include/llvm/FuzzMutate/OpDescriptor.h b/llvm/include/llvm/FuzzMutate/OpDescriptor.h index 3e515dee75105..00a8ea0e5babc 100644 --- a/llvm/include/llvm/FuzzMutate/OpDescriptor.h +++ b/llvm/include/llvm/FuzzMutate/OpDescriptor.h @@ -166,14 +166,7 @@ static inline SourcePred sizedPtrType() { if (V->isSwiftError()) return false; -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY return V->getType()->isPointerTy(); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - if (const auto *PtrT = dyn_cast(V->getType())) - return PtrT->isOpaque() || - PtrT->getNonOpaquePointerElementType()->isSized(); - return false; -#endif // INTEL_SYCL_OPAQUEPOINTER_READY }; auto Make = [](ArrayRef, ArrayRef Ts) { std::vector Result; diff --git a/llvm/include/llvm/FuzzMutate/RandomIRBuilder.h b/llvm/include/llvm/FuzzMutate/RandomIRBuilder.h index 9fe89e2dd3c6d..1a422fcc0be6e 100644 --- a/llvm/include/llvm/FuzzMutate/RandomIRBuilder.h +++ b/llvm/include/llvm/FuzzMutate/RandomIRBuilder.h @@ -96,12 +96,7 @@ struct RandomIRBuilder { Value *V); /// Create a user for \c V in \c BB. Instruction *newSink(BasicBlock &BB, ArrayRef Insts, Value *V); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Value *findPointer(BasicBlock &BB, ArrayRef Insts); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - Value *findPointer(BasicBlock &BB, ArrayRef Insts, - ArrayRef Srcs, fuzzerop::SourcePred Pred); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY /// Return a uniformly choosen type from \c AllowedTypes Type *randomType(); Function *createFunctionDeclaration(Module &M, uint64_t ArgNum); diff --git a/llvm/include/llvm/IR/DerivedTypes.h b/llvm/include/llvm/IR/DerivedTypes.h index 683a60c3c1858..8baa5b6fc1ab5 100644 --- a/llvm/include/llvm/IR/DerivedTypes.h +++ b/llvm/include/llvm/IR/DerivedTypes.h @@ -643,9 +643,6 @@ inline ElementCount VectorType::getElementCount() const { class PointerType : public Type { explicit PointerType(LLVMContext &C, unsigned AddrSpace); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - explicit PointerType(Type *ElType, unsigned AddrSpace); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY Type *PointeeTy; public: @@ -676,16 +673,10 @@ class PointerType : public Type { /// given address space. This is only useful during the opaque pointer /// transition. /// TODO: remove after opaque pointer transition is complete. - [[deprecated("Use PointerType::get() with LLVMContext argument instead")]] - static PointerType *getWithSamePointeeType(PointerType *PT, - unsigned AddressSpace) { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY + [[deprecated("Use PointerType::get() with LLVMContext argument " + "instead")]] static PointerType * + getWithSamePointeeType(PointerType *PT, unsigned AddressSpace) { return get(PT->getContext(), AddressSpace); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - if (PT->isOpaque()) - return get(PT->getContext(), AddressSpace); - return get(PT->PointeeTy, AddressSpace); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY } [[deprecated("Pointer element types are deprecated. You can *temporarily* " @@ -695,12 +686,7 @@ class PointerType : public Type { return PointeeTy; } -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - [[deprecated("Always returns true")]] - bool isOpaque() const { return true; } -#else // INTEL_SYCL_OPAQUEPOINTER_READY - bool isOpaque() const { return !PointeeTy; } -#endif // INTEL_SYCL_OPAQUEPOINTER_READY + [[deprecated("Always returns true")]] bool isOpaque() const { return true; } /// Return true if the specified type is valid as a element type. static bool isValidElementType(Type *ElemTy); @@ -715,31 +701,19 @@ class PointerType : public Type { /// type matches Ty. Primarily used for checking if an instruction's pointer /// operands are valid types. Will be useless after non-opaque pointers are /// removed. -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY [[deprecated("Always returns true")]] bool isOpaqueOrPointeeTypeMatches(Type *) { return true; } -#else // INTEL_SYCL_OPAQUEPOINTER_READY - bool isOpaqueOrPointeeTypeMatches(Type *Ty) { - return isOpaque() || PointeeTy == Ty; - } -#endif // INTEL_SYCL_OPAQUEPOINTER_READY /// Return true if both pointer types have the same element type. Two opaque /// pointers are considered to have the same element type, while an opaque /// and a non-opaque pointer have different element types. /// TODO: Remove after opaque pointer transition is complete. -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY [[deprecated("Always returns true")]] bool hasSameElementTypeAs(PointerType *Other) { return true; } -#else // INTEL_SYCL_OPAQUEPOINTER_READY - bool hasSameElementTypeAs(PointerType *Other) { - return PointeeTy == Other->PointeeTy; - } -#endif // INTEL_SYCL_OPAQUEPOINTER_READY /// Implement support type inquiry through isa, cast, and dyn_cast. static bool classof(const Type *T) { diff --git a/llvm/include/llvm/IR/IRBuilder.h b/llvm/include/llvm/IR/IRBuilder.h index 4de11ad1d7123..10125835e3f78 100644 --- a/llvm/include/llvm/IR/IRBuilder.h +++ b/llvm/include/llvm/IR/IRBuilder.h @@ -140,10 +140,6 @@ class IRBuilderBase { ClearInsertionPoint(); } -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Value *getCastedInt8PtrValue(Value *Ptr); -#endif - /// Insert and return the specified instruction. template InstTy *Insert(InstTy *I, const Twine &Name = "") const { @@ -562,11 +558,7 @@ class IRBuilderBase { /// Fetch the type representing a pointer to an 8-bit integer value. PointerType *getInt8PtrTy(unsigned AddrSpace = 0) { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY return getPtrTy(AddrSpace); -#else - return Type::getInt8PtrTy(Context, AddrSpace); -#endif } /// Fetch the type of an integer with size at least as big as that of a diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h index 18e982665fce8..99e96c4cccc73 100644 --- a/llvm/include/llvm/IR/Instructions.h +++ b/llvm/include/llvm/IR/Instructions.h @@ -1077,7 +1077,6 @@ class GetElementPtrInst : public Instruction { /// Returns the pointer type returned by the GEP /// instruction, which may be a vector of pointers. -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY static Type *getGEPReturnType(Value *Ptr, ArrayRef IdxList) { // Vector GEP Type *Ty = Ptr->getType(); @@ -1092,29 +1091,6 @@ class GetElementPtrInst : public Instruction { // Scalar GEP return Ty; } -#else // INTEL_SYCL_OPAQUEPOINTER_READY - static Type *getGEPReturnType(Type *ElTy, Value *Ptr, - ArrayRef IdxList) { - PointerType *OrigPtrTy = cast(Ptr->getType()->getScalarType()); - unsigned AddrSpace = OrigPtrTy->getAddressSpace(); - Type *ResultElemTy = checkGEPType(getIndexedType(ElTy, IdxList)); - Type *PtrTy = OrigPtrTy->isOpaque() - ? PointerType::get(OrigPtrTy->getContext(), AddrSpace) - : PointerType::get(ResultElemTy, AddrSpace); - // Vector GEP - if (auto *PtrVTy = dyn_cast(Ptr->getType())) { - ElementCount EltCount = PtrVTy->getElementCount(); - return VectorType::get(PtrTy, EltCount); - } - for (Value *Index : IdxList) - if (auto *IndexVTy = dyn_cast(Index->getType())) { - ElementCount EltCount = IndexVTy->getElementCount(); - return VectorType::get(PtrTy, EltCount); - } - // Scalar GEP - return PtrTy; - } -#endif // INTEL_SYCL_OPAQUEPOINTER_READY unsigned getNumIndices() const { // Note: always non-negative return getNumOperands() - 1; @@ -1171,11 +1147,7 @@ GetElementPtrInst::GetElementPtrInst(Type *PointeeType, Value *Ptr, ArrayRef IdxList, unsigned Values, const Twine &NameStr, Instruction *InsertBefore) -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY : Instruction(getGEPReturnType(Ptr, IdxList), GetElementPtr, -#else // INTEL_SYCL_OPAQUEPOINTER_READY - : Instruction(getGEPReturnType(PointeeType, Ptr, IdxList), GetElementPtr, -#endif // INTEL_SYCL_OPAQUEPOINTER_READY OperandTraits::op_end(this) - Values, Values, InsertBefore), SourceElementType(PointeeType), @@ -1187,11 +1159,7 @@ GetElementPtrInst::GetElementPtrInst(Type *PointeeType, Value *Ptr, ArrayRef IdxList, unsigned Values, const Twine &NameStr, BasicBlock *InsertAtEnd) -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY : Instruction(getGEPReturnType(Ptr, IdxList), GetElementPtr, -#else // INTEL_SYCL_OPAQUEPOINTER_READY - : Instruction(getGEPReturnType(PointeeType, Ptr, IdxList), GetElementPtr, -#endif // INTEL_SYCL_OPAQUEPOINTER_READY OperandTraits::op_end(this) - Values, Values, InsertAtEnd), SourceElementType(PointeeType), diff --git a/llvm/include/llvm/IR/Intrinsics.h b/llvm/include/llvm/IR/Intrinsics.h index 5a8d3fe13ed9e..10dc0c280118e 100644 --- a/llvm/include/llvm/IR/Intrinsics.h +++ b/llvm/include/llvm/IR/Intrinsics.h @@ -128,10 +128,6 @@ namespace Intrinsic { TruncArgument, HalfVecArgument, SameVecWidthArgument, -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - PtrToArgument, - PtrToElt, -#endif // INTEL_SYCL_OPAQUEPOINTER_READY VecOfAnyPtrsToElt, VecElementArgument, Subdivide2Argument, @@ -139,9 +135,6 @@ namespace Intrinsic { VecOfBitcastsToInt, AMX, PPCQuad, -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - AnyPtrToElt, -#endif // INTEL_SYCL_OPAQUEPOINTER_READY AArch64Svcount, } Kind; @@ -162,58 +155,30 @@ namespace Intrinsic { }; unsigned getArgumentNumber() const { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY assert(Kind == Argument || Kind == ExtendArgument || Kind == TruncArgument || Kind == HalfVecArgument || Kind == SameVecWidthArgument || Kind == VecElementArgument || Kind == Subdivide2Argument || Kind == Subdivide4Argument || Kind == VecOfBitcastsToInt); -#else - assert(Kind == Argument || Kind == ExtendArgument || - Kind == TruncArgument || Kind == HalfVecArgument || - Kind == SameVecWidthArgument || - Kind == PtrToArgument || - Kind == PtrToElt || Kind == VecElementArgument || - Kind == Subdivide2Argument || Kind == Subdivide4Argument || - Kind == VecOfBitcastsToInt); - -#endif // INTEL_SYCL_OPAQUEPOINTER_READY return Argument_Info >> 3; } ArgKind getArgumentKind() const { -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - assert(Kind == Argument || Kind == ExtendArgument || - Kind == TruncArgument || Kind == HalfVecArgument || - Kind == PtrToArgument || - Kind == SameVecWidthArgument || - Kind == VecElementArgument || Kind == Subdivide2Argument || - Kind == Subdivide4Argument || Kind == VecOfBitcastsToInt); -#else assert(Kind == Argument || Kind == ExtendArgument || Kind == TruncArgument || Kind == HalfVecArgument || - Kind == SameVecWidthArgument || - Kind == VecElementArgument || Kind == Subdivide2Argument || - Kind == Subdivide4Argument || Kind == VecOfBitcastsToInt); -#endif + Kind == SameVecWidthArgument || Kind == VecElementArgument || + Kind == Subdivide2Argument || Kind == Subdivide4Argument || + Kind == VecOfBitcastsToInt); return (ArgKind)(Argument_Info & 7); } // VecOfAnyPtrsToElt uses both an overloaded argument (for address space) // and a reference argument (for matching vector width and element types) unsigned getOverloadArgNumber() const { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY assert(Kind == VecOfAnyPtrsToElt); -#else - assert(Kind == VecOfAnyPtrsToElt || Kind == AnyPtrToElt); -#endif return Argument_Info >> 16; } unsigned getRefArgNumber() const { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY assert(Kind == VecOfAnyPtrsToElt); -#else - assert(Kind == VecOfAnyPtrsToElt || Kind == AnyPtrToElt); -#endif return Argument_Info & 0xFFFF; } diff --git a/llvm/include/llvm/IR/Intrinsics.td b/llvm/include/llvm/IR/Intrinsics.td index a3242f45536bb..7c117c365d0c9 100644 --- a/llvm/include/llvm/IR/Intrinsics.td +++ b/llvm/include/llvm/IR/Intrinsics.td @@ -294,10 +294,6 @@ def IIT_V1 : IIT_Vec<1, 28>; def IIT_VARARG : IIT_VT; def IIT_HALF_VEC_ARG : IIT_Base<30>; def IIT_SAME_VEC_WIDTH_ARG : IIT_Base<31>; -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY -def IIT_PTR_TO_ARG : IIT_Base<32>; -def IIT_PTR_TO_ELT : IIT_Base<33>; -#endif // INTEL_SYCL_OPAQUEPOINTER_READY def IIT_VEC_OF_ANYPTRS_TO_ELT : IIT_Base<34>; def IIT_I128 : IIT_Int<128, 35>; def IIT_V512 : IIT_Vec<512, 36>; @@ -320,9 +316,6 @@ def IIT_PPCF128 : IIT_VT; def IIT_V3 : IIT_Vec<3, 53>; def IIT_EXTERNREF : IIT_VT; def IIT_FUNCREF : IIT_VT; -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY -def IIT_ANYPTR_TO_ELT : IIT_Base<56>; -#endif // INTEL_SYCL_OPAQUEPOINTER_READY def IIT_I2 : IIT_Int<2, 57>; def IIT_I4 : IIT_Int<4, 58>; def IIT_AARCH64_SVCOUNT : IIT_VT; @@ -464,12 +457,6 @@ class LLVMScalarOrSameVectorWidth ], elty.Sig); } -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY -class LLVMPointerTo : LLVMMatchType; -class LLVMPointerToElt : LLVMMatchType; -class LLVMAnyPointerToElt - : LLVMMatchTypeNextArg; -#endif // INTEL_SYCL_OPAQUEPOINTER_READY class LLVMVectorOfAnyPointersToElt : LLVMMatchTypeNextArg; class LLVMVectorElementType : LLVMMatchType; @@ -1912,22 +1899,14 @@ def int_vp_scatter: DefaultAttrsIntrinsic<[], // Experimental strided memory accesses def int_experimental_vp_strided_store : DefaultAttrsIntrinsic<[], [ llvm_anyvector_ty, -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY llvm_anyptr_ty, -#else - LLVMAnyPointerToElt<0>, -#endif llvm_anyint_ty, // Stride in bytes LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>, llvm_i32_ty], [ NoCapture>, IntrNoSync, IntrWriteMem, IntrArgMemOnly, IntrWillReturn ]>; def int_experimental_vp_strided_load : DefaultAttrsIntrinsic<[llvm_anyvector_ty], -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY [ llvm_anyptr_ty, -#else - [ LLVMAnyPointerToElt<0>, -#endif llvm_anyint_ty, // Stride in bytes LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>, llvm_i32_ty], @@ -2355,21 +2334,13 @@ def int_masked_scatter: def int_masked_expandload: DefaultAttrsIntrinsic<[llvm_anyvector_ty], -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY [llvm_ptr_ty, LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>, -#else - [LLVMPointerToElt<0>, LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>, -#endif LLVMMatchType<0>], [IntrReadMem, IntrWillReturn, NoCapture>]>; def int_masked_compressstore: DefaultAttrsIntrinsic<[], -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY [llvm_anyvector_ty, llvm_ptr_ty, -#else - [llvm_anyvector_ty, LLVMPointerToElt<0>, -#endif LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>], [IntrWriteMem, IntrArgMemOnly, IntrWillReturn, NoCapture>]>; @@ -2508,11 +2479,7 @@ def int_matrix_multiply def int_matrix_column_major_load : DefaultAttrsIntrinsic<[llvm_anyvector_ty], -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY [llvm_ptr_ty, llvm_anyint_ty, llvm_i1_ty, -#else - [LLVMPointerToElt<0>, llvm_anyint_ty, llvm_i1_ty, -#endif llvm_i32_ty, llvm_i32_ty], [IntrNoSync, IntrWillReturn, IntrArgMemOnly, IntrReadMem, NoCapture>, ImmArg>, ImmArg>, @@ -2520,11 +2487,7 @@ def int_matrix_column_major_load def int_matrix_column_major_store : DefaultAttrsIntrinsic<[], -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY [llvm_anyvector_ty, llvm_ptr_ty, -#else - [llvm_anyvector_ty, LLVMPointerToElt<0>, -#endif llvm_anyint_ty, llvm_i1_ty, llvm_i32_ty, llvm_i32_ty], [IntrNoSync, IntrWillReturn, IntrArgMemOnly, IntrWriteMem, WriteOnly>, NoCapture>, diff --git a/llvm/include/llvm/IR/IntrinsicsNVVM.td b/llvm/include/llvm/IR/IntrinsicsNVVM.td index 1379c9e54a283..366cf5a9d5508 100644 --- a/llvm/include/llvm/IR/IntrinsicsNVVM.td +++ b/llvm/include/llvm/IR/IntrinsicsNVVM.td @@ -1315,19 +1315,11 @@ let TargetPrefix = "nvvm" in { class SCOPED_ATOMIC_ld_impl : Intrinsic<[elty], -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY [llvm_anyptr_ty], -#else - [LLVMAnyPointerType>], -#endif [IntrArgMemOnly, NoCapture>]>; class SCOPED_ATOMIC_st_impl : Intrinsic<[], -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY [llvm_anyptr_ty, elty], -#else - [LLVMAnyPointerType>, elty], -#endif [IntrArgMemOnly, NoCapture>]>; class SCOPED_ATOMIC2_impl : Intrinsic<[elty], @@ -4789,11 +4781,7 @@ foreach layout_a = ["row", "col"] in { // SYCL def int_nvvm_implicit_offset : ClangBuiltin<"__builtin_ptx_implicit_offset">, -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Intrinsic<[llvm_ptr_ty], [], -#else - Intrinsic<[LLVMPointerType], [], -#endif [IntrNoMem, IntrSpeculatable]>; // LDMATRIX diff --git a/llvm/include/llvm/IR/Type.h b/llvm/include/llvm/IR/Type.h index 4ce0f40385721..da6a24026ec1c 100644 --- a/llvm/include/llvm/IR/Type.h +++ b/llvm/include/llvm/IR/Type.h @@ -255,13 +255,9 @@ class Type { /// True if this is an instance of PointerType. bool isPointerTy() const { return getTypeID() == PointerTyID; } -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY /// True if this is an instance of an opaque PointerType. LLVM_DEPRECATED("Use isPointerTy() instead", "isPointerTy") bool isOpaquePointerTy() const { return isPointerTy(); }; -#else // INTEL_SYCL_OPAQUEPOINTER_READY - bool isOpaquePointerTy() const; -#endif // INTEL_SYCL_OPAQUEPOINTER_READY /// Return true if this is a pointer type or a vector of pointer types. bool isPtrOrPtrVectorTy() const { return getScalarType()->isPointerTy(); } @@ -416,19 +412,10 @@ class Type { /// Only use this method in code that is not reachable with opaque pointers, /// or part of deprecated methods that will be removed as part of the opaque /// pointers transition. -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY [[deprecated("Pointers no longer have element types")]] Type *getNonOpaquePointerElementType() const { llvm_unreachable("Pointers no longer have element types"); } -#else // INTEL_SYCL_OPAQUEPOINTER_READY - Type *getNonOpaquePointerElementType() const { - assert(getTypeID() == PointerTyID); - assert(NumContainedTys && - "Attempting to get element type of opaque pointer"); - return ContainedTys[0]; - } -#endif // INTEL_SYCL_OPAQUEPOINTER_READY /// Given vector type, change the element type, /// whilst keeping the old number of elements. @@ -497,28 +484,9 @@ class Type { // Convenience methods for getting pointer types. // -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY // TODO: After opaque pointer transition these can be replaced by simply // calling PointerType::get(C, AS). -#else //INTEL_SYCL_OPAQUEPOINTER_READY - static PointerType *getHalfPtrTy(LLVMContext &C, unsigned AS = 0); - static PointerType *getBFloatPtrTy(LLVMContext &C, unsigned AS = 0); - static PointerType *getFloatPtrTy(LLVMContext &C, unsigned AS = 0); - static PointerType *getDoublePtrTy(LLVMContext &C, unsigned AS = 0); - static PointerType *getX86_FP80PtrTy(LLVMContext &C, unsigned AS = 0); - static PointerType *getFP128PtrTy(LLVMContext &C, unsigned AS = 0); - static PointerType *getPPC_FP128PtrTy(LLVMContext &C, unsigned AS = 0); - static PointerType *getX86_MMXPtrTy(LLVMContext &C, unsigned AS = 0); - static PointerType *getX86_AMXPtrTy(LLVMContext &C, unsigned AS = 0); - static PointerType *getIntNPtrTy(LLVMContext &C, unsigned N, unsigned AS = 0); - static PointerType *getInt1PtrTy(LLVMContext &C, unsigned AS = 0); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY static PointerType *getInt8PtrTy(LLVMContext &C, unsigned AS = 0); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - static PointerType *getInt16PtrTy(LLVMContext &C, unsigned AS = 0); - static PointerType *getInt32PtrTy(LLVMContext &C, unsigned AS = 0); - static PointerType *getInt64PtrTy(LLVMContext &C, unsigned AS = 0); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY static Type *getWasm_ExternrefTy(LLVMContext &C); static Type *getWasm_FuncrefTy(LLVMContext &C); /// Return a pointer to the current type. This is equivalent to diff --git a/llvm/include/llvm/Transforms/Utils/BuildLibCalls.h b/llvm/include/llvm/Transforms/Utils/BuildLibCalls.h index cdd484d4474fe..9ebb950077742 100644 --- a/llvm/include/llvm/Transforms/Utils/BuildLibCalls.h +++ b/llvm/include/llvm/Transforms/Utils/BuildLibCalls.h @@ -80,11 +80,6 @@ namespace llvm { LibFunc DoubleFn, LibFunc FloatFn, LibFunc LongDoubleFn, LibFunc &TheLibFunc); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - /// Return V if it is an i8*, otherwise cast it to i8*. - Value *castToCStr(Value *V, IRBuilderBase &B); - -#endif //INTEL_SYCL_OPAQUEPOINTER_READY /// Emit a call to the strlen function to the builder, for the specified /// pointer. Ptr is required to be some pointer type, and the return value has /// 'size_t' type. diff --git a/llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h b/llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h index b2425bf5c686c..b3f7e90c901fe 100644 --- a/llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h +++ b/llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h @@ -435,13 +435,7 @@ class SCEVExpander : public SCEVVisitor { /// Expand a SCEVAddExpr with a pointer type into a GEP instead of using /// ptrtoint+arithmetic+inttoptr. -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Value *expandAddToGEP(const SCEV *Op, Type *Ty, Value *V); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - Value *expandAddToGEP(const SCEV *const *op_begin, const SCEV *const *op_end, - PointerType *PTy, Type *Ty, Value *V); - Value *expandAddToGEP(const SCEV *Op, PointerType *PTy, Type *Ty, Value *V); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY /// Find a previous Value in ExprValueMap for expand. /// DropPoisonGeneratingInsts is populated with instructions for which diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp index f4ab121834126..1a325f3504df0 100644 --- a/llvm/lib/Analysis/ConstantFolding.cpp +++ b/llvm/lib/Analysis/ConstantFolding.cpp @@ -942,10 +942,6 @@ Constant *SymbolicallyEvaluateGEP(const GEPOperator *GEP, // For GEPs of GlobalValues, use the value type, otherwise use an i8 GEP. if (auto *GV = dyn_cast(Ptr)) SrcElemTy = GV->getValueType(); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - else if (!PTy->isOpaque()) - SrcElemTy = PTy->getNonOpaquePointerElementType(); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY else SrcElemTy = Type::getInt8Ty(Ptr->getContext()); @@ -988,23 +984,8 @@ Constant *SymbolicallyEvaluateGEP(const GEPOperator *GEP, } // Create a GEP. -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY return ConstantExpr::getGetElementPtr(SrcElemTy, Ptr, NewIdxs, InBounds, InRangeIndex); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - Constant *C = ConstantExpr::getGetElementPtr(SrcElemTy, Ptr, NewIdxs, - InBounds, InRangeIndex); - assert( - cast(C->getType())->isOpaqueOrPointeeTypeMatches(ElemTy) && - "Computed GetElementPtr has unexpected type!"); - - // If we ended up indexing a member with a type that doesn't match - // the type of what the original indices indexed, add a cast. - if (C->getType() != ResTy) - C = FoldBitCast(C, ResTy, DL); - - return C; -#endif // INTEL_SYCL_OPAQUEPOINTER_READY } /// Attempt to constant fold an instruction with the diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp index 01fd72959dbe1..130bb2f2ba14a 100644 --- a/llvm/lib/Analysis/InstructionSimplify.cpp +++ b/llvm/lib/Analysis/InstructionSimplify.cpp @@ -4913,15 +4913,8 @@ static Value *simplifyGEPInst(Type *SrcTy, Value *Ptr, } } -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY // All-zero GEP is a no-op, unless it performs a vector splat. if (Ptr->getType() == GEPTy && -#else // INTEL_SYCL_OPAQUEPOINTER_READY - // For opaque pointers an all-zero GEP is a no-op. For typed pointers, - // it may be equivalent to a bitcast. - if (Ptr->getType()->getScalarType()->isOpaquePointerTy() && - Ptr->getType() == GEPTy && -#endif // INTEL_SYCL_OPAQUEPOINTER_READY all_of(Indices, [](const auto *V) { return match(V, m_Zero()); })) return Ptr; diff --git a/llvm/lib/AsmParser/LLLexer.cpp b/llvm/lib/AsmParser/LLLexer.cpp index 62da3645f4725..9f414f50bc31c 100644 --- a/llvm/lib/AsmParser/LLLexer.cpp +++ b/llvm/lib/AsmParser/LLLexer.cpp @@ -826,21 +826,7 @@ lltok::Kind LLLexer::LexIdentifier() { TYPEKEYWORD("x86_amx", Type::getX86_AMXTy(Context)); TYPEKEYWORD("token", Type::getTokenTy(Context)); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - TYPEKEYWORD("ptr", PointerType::getUnqual(Context)); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - if (Keyword == "ptr") { - // setOpaquePointers() must be called before creating any pointer types. - if (!Context.hasSetOpaquePointersValue()) { - Context.setOpaquePointers(true); - } else if (Context.supportsTypedPointers()) { - Warning("ptr type is only supported in -opaque-pointers mode"); - return lltok::Error; - } - TyVal = PointerType::getUnqual(Context); - return lltok::Type; - } -#endif // INTEL_SYCL_OPAQUEPOINTER_READY + TYPEKEYWORD("ptr", PointerType::getUnqual(Context)); #undef TYPEKEYWORD diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index 4f7e8eb230714..69895c0e6ea7c 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -61,33 +61,9 @@ static std::string getTypeString(Type *T) { return Tmp.str(); } -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY -static void setContextOpaquePointers(LLLexer &L, LLVMContext &C) { - while (true) { - lltok::Kind K = L.Lex(); - // LLLexer will set the opaque pointers option in LLVMContext if it sees an - // explicit "ptr". - if (K == lltok::star || K == lltok::Error || K == lltok::Eof || - isa_and_nonnull(L.getTyVal())) { - if (K == lltok::star) - C.setOpaquePointers(false); - return; - } - } -} -#endif /// Run: module ::= toplevelentity* bool LLParser::Run(bool UpgradeDebugInfo, DataLayoutCallbackTy DataLayoutCallback) { -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - // If we haven't decided on whether or not we're using opaque pointers, do a - // quick lex over the tokens to see if we explicitly construct any typed or - // opaque pointer types. - // Don't bail out on an error so we do the same work in the parsing below - // regardless of if --opaque-pointers is set. - if (!Context.hasSetOpaquePointersValue()) - setContextOpaquePointers(OPLex, Context); -#endif // Prime the lexer. Lex.Lex(); @@ -998,16 +974,6 @@ static void maybeSetDSOLocal(bool DSOLocal, GlobalValue &GV) { GV.setDSOLocal(true); } -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY -static std::string typeComparisonErrorMessage(StringRef Message, Type *Ty1, - Type *Ty2) { - std::string ErrString; - raw_string_ostream ErrOS(ErrString); - ErrOS << Message << " (" << *Ty1 << " vs " << *Ty2 << ")"; - return ErrOS.str(); -} -#endif // INTEL_SYCL_OPAQUEPOINTER_READY - /// parseAliasOrIFunc: /// ::= GlobalVar '=' OptionalLinkage OptionalPreemptionSpecifier /// OptionalVisibility OptionalDLLStorageClass @@ -1079,22 +1045,6 @@ bool LLParser::parseAliasOrIFunc(const std::string &Name, LocTy NameLoc, return error(AliaseeLoc, "An alias or ifunc must have pointer type"); unsigned AddrSpace = PTy->getAddressSpace(); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - if (IsAlias) { - if (!PTy->isOpaqueOrPointeeTypeMatches(Ty)) - return error( - ExplicitTypeLoc, - typeComparisonErrorMessage( - "explicit pointee type doesn't match operand's pointee type", Ty, - PTy->getNonOpaquePointerElementType())); - } else { - if (!PTy->isOpaque() && - !PTy->getNonOpaquePointerElementType()->isFunctionTy()) - return error(ExplicitTypeLoc, - "explicit pointee type should be a function type"); - } -#endif // INTEL_SYCL_OPAQUEPOINTER_READY - GlobalValue *GVal = nullptr; // See if the alias was forward referenced, if so, prepare to replace the @@ -1611,31 +1561,12 @@ bool LLParser::parseFnAttributeValuePairs(AttrBuilder &B, //===----------------------------------------------------------------------===// static inline GlobalValue *createGlobalFwdRef(Module *M, PointerType *PTy) { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY // The used global type does not matter. We will later RAUW it with a // global/function of the correct type. return new GlobalVariable(*M, Type::getInt8Ty(M->getContext()), false, GlobalValue::ExternalWeakLinkage, nullptr, "", nullptr, GlobalVariable::NotThreadLocal, PTy->getAddressSpace()); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - // For opaque pointers, the used global type does not matter. We will later - // RAUW it with a global/function of the correct type. - if (PTy->isOpaque()) - return new GlobalVariable(*M, Type::getInt8Ty(M->getContext()), false, - GlobalValue::ExternalWeakLinkage, nullptr, "", - nullptr, GlobalVariable::NotThreadLocal, - PTy->getAddressSpace()); - - Type *ElemTy = PTy->getNonOpaquePointerElementType(); - if (auto *FT = dyn_cast(ElemTy)) - return Function::Create(FT, GlobalValue::ExternalWeakLinkage, - PTy->getAddressSpace(), "", M); - else - return new GlobalVariable( - *M, ElemTy, false, GlobalValue::ExternalWeakLinkage, nullptr, "", - nullptr, GlobalVariable::NotThreadLocal, PTy->getAddressSpace()); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY } Value *LLParser::checkValidVariableType(LocTy Loc, const Twine &Name, Type *Ty, @@ -2712,11 +2643,7 @@ bool LLParser::parseType(Type *&Result, const Twine &Msg, bool AllowVoid) { // Handle "ptr" opaque pointer type. // // Type ::= ptr ('addrspace' '(' uint32 ')')? -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY if (Result->isPointerTy()) { -#else // INTEL_SYCL_OPAQUEPOINTER_READY - if (Result->isOpaquePointerTy()) { -#endif // INTEL_SYCL_OPAQUEPOINTER_READY unsigned AddrSpace; if (parseOptionalAddrSpace(AddrSpace)) return true; @@ -4077,9 +4004,6 @@ bool LLParser::parseValID(ValID &ID, PerFunctionState *PFS, Type *ExpectedTy) { if (parseToken(lltok::lparen, "expected '(' in constantexpr")) return true; -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - LocTy ExplicitTypeLoc = Lex.getLoc(); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY if (Opc == Instruction::GetElementPtr) { if (parseType(Ty) || parseToken(lltok::comma, "expected comma after getelementptr's type")) @@ -4098,16 +4022,6 @@ bool LLParser::parseValID(ValID &ID, PerFunctionState *PFS, Type *ExpectedTy) { return error(ID.Loc, "base of getelementptr must be a pointer"); Type *BaseType = Elts[0]->getType(); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - auto *BasePointerType = cast(BaseType->getScalarType()); - if (!BasePointerType->isOpaqueOrPointeeTypeMatches(Ty)) { - return error( - ExplicitTypeLoc, - typeComparisonErrorMessage( - "explicit pointee type doesn't match operand's pointee type", - Ty, BasePointerType->getNonOpaquePointerElementType())); - } -#endif // INTEL_SYCL_OPAQUEPOINTER_READY unsigned GEPWidth = BaseType->isVectorTy() ? cast(BaseType)->getNumElements() @@ -6141,12 +6055,6 @@ bool LLParser::parseFunctionHeader(Function *&Fn, bool IsDefine) { auto FRVI = ForwardRefVals.find(FunctionName); if (FRVI != ForwardRefVals.end()) { FwdFn = FRVI->second.first; -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - if (!FwdFn->getType()->isOpaque() && - !FwdFn->getType()->getNonOpaquePointerElementType()->isFunctionTy()) - return error(FRVI->second.second, "invalid forward reference to " - "function as global value!"); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY if (FwdFn->getType() != PFT) return error(FRVI->second.second, "invalid forward reference to " @@ -7727,15 +7635,6 @@ int LLParser::parseLoad(Instruction *&Inst, PerFunctionState &PFS) { Ordering == AtomicOrdering::AcquireRelease) return error(Loc, "atomic load cannot use Release ordering"); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - if (!cast(Val->getType())->isOpaqueOrPointeeTypeMatches(Ty)) { - return error( - ExplicitTypeLoc, - typeComparisonErrorMessage( - "explicit pointee type doesn't match operand's pointee type", Ty, - Val->getType()->getNonOpaquePointerElementType())); - } -#endif // INTEL_SYCL_OPAQUEPOINTER_READY SmallPtrSet Visited; if (!Alignment && !Ty->isSized(&Visited)) return error(ExplicitTypeLoc, "loading unsized types is not allowed"); @@ -7780,11 +7679,6 @@ int LLParser::parseStore(Instruction *&Inst, PerFunctionState &PFS) { return error(PtrLoc, "store operand must be a pointer"); if (!Val->getType()->isFirstClassType()) return error(Loc, "store operand must be a first class value"); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - if (!cast(Ptr->getType()) - ->isOpaqueOrPointeeTypeMatches(Val->getType())) - return error(Loc, "stored value and pointer type do not match"); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY if (isAtomic && !Alignment) return error(Loc, "atomic store must have explicit non-zero alignment"); if (Ordering == AtomicOrdering::Acquire || @@ -7836,14 +7730,6 @@ int LLParser::parseCmpXchg(Instruction *&Inst, PerFunctionState &PFS) { return tokError("invalid cmpxchg failure ordering"); if (!Ptr->getType()->isPointerTy()) return error(PtrLoc, "cmpxchg operand must be a pointer"); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - if (!cast(Ptr->getType()) - ->isOpaqueOrPointeeTypeMatches(Cmp->getType())) - return error(CmpLoc, "compare value and pointer type do not match"); - if (!cast(Ptr->getType()) - ->isOpaqueOrPointeeTypeMatches(New->getType())) - return error(NewLoc, "new value and pointer type do not match"); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY if (Cmp->getType() != New->getType()) return error(NewLoc, "compare value and new value type do not match"); if (!New->getType()->isFirstClassType()) @@ -7929,11 +7815,6 @@ int LLParser::parseAtomicRMW(Instruction *&Inst, PerFunctionState &PFS) { return tokError("atomicrmw cannot be unordered"); if (!Ptr->getType()->isPointerTy()) return error(PtrLoc, "atomicrmw operand must be a pointer"); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - if (!cast(Ptr->getType()) - ->isOpaqueOrPointeeTypeMatches(Val->getType())) - return error(ValLoc, "atomicrmw value and pointer type do not match"); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY if (Operation == AtomicRMWInst::Xchg) { if (!Val->getType()->isIntegerTy() && @@ -8002,9 +7883,6 @@ int LLParser::parseGetElementPtr(Instruction *&Inst, PerFunctionState &PFS) { bool InBounds = EatIfPresent(lltok::kw_inbounds); Type *Ty = nullptr; -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - LocTy ExplicitTypeLoc = Lex.getLoc(); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY if (parseType(Ty) || parseToken(lltok::comma, "expected comma after getelementptr's type") || parseTypeAndValue(Ptr, Loc, PFS)) @@ -8015,16 +7893,6 @@ int LLParser::parseGetElementPtr(Instruction *&Inst, PerFunctionState &PFS) { if (!BasePointerType) return error(Loc, "base of getelementptr must be a pointer"); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - if (!BasePointerType->isOpaqueOrPointeeTypeMatches(Ty)) { - return error( - ExplicitTypeLoc, - typeComparisonErrorMessage( - "explicit pointee type doesn't match operand's pointee type", Ty, - BasePointerType->getNonOpaquePointerElementType())); - } -#endif // INTEL_SYCL_OPAQUEPOINTER_READY - SmallVector Indices; bool AteExtraComma = false; // GEP returns a vector of pointers if at least one of parameters is a vector. diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index f0ce0735d33d1..02afc738df7a9 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -1374,18 +1374,6 @@ unsigned BitcodeReader::getVirtualTypeID(Type *Ty, "Incorrect cached contained type IDs"); return It->second; } -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY -#ifndef NDEBUG - if (!Ty->isOpaquePointerTy()) { - assert(Ty->getNumContainedTypes() == ChildTypeIDs.size() && - "Wrong number of contained types"); - for (auto Pair : zip(Ty->subtypes(), ChildTypeIDs)) { - assert(std::get<0>(Pair) == getTypeByID(std::get<1>(Pair)) && - "Incorrect contained type ID"); - } - } -#endif -#endif // INTEL_SYCL_OPAQUEPOINTER_READY unsigned TypeID = TypeList.size(); TypeList.push_back(Ty); @@ -2364,10 +2352,6 @@ Error BitcodeReader::parseTypeTableBody() { // [pointee type, address space] if (Record.empty()) return error("Invalid pointer record"); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - if (LLVM_UNLIKELY(!Context.hasSetOpaquePointersValue())) - Context.setOpaquePointers(false); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY unsigned AddressSpace = 0; if (Record.size() == 2) AddressSpace = Record[1]; @@ -2382,13 +2366,6 @@ Error BitcodeReader::parseTypeTableBody() { case bitc::TYPE_CODE_OPAQUE_POINTER: { // OPAQUE_POINTER: [addrspace] if (Record.size() != 1) return error("Invalid opaque pointer record"); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - if (LLVM_UNLIKELY(!Context.hasSetOpaquePointersValue())) { - Context.setOpaquePointers(true); - } else if (Context.supportsTypedPointers()) - return error( - "Opaque pointers are only supported in -opaque-pointers mode"); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY unsigned AddressSpace = Record[0]; ResultTy = PointerType::get(Context, AddressSpace); break; diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index 3deefe1b6733a..9416c7f5a03e3 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -977,26 +977,11 @@ void ModuleBitcodeWriter::writeTypeTable() { case Type::PointerTyID: { PointerType *PTy = cast(T); unsigned AddressSpace = PTy->getAddressSpace(); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY // OPAQUE_POINTER: [address space] Code = bitc::TYPE_CODE_OPAQUE_POINTER; TypeVals.push_back(AddressSpace); if (AddressSpace == 0) AbbrevToUse = OpaquePtrAbbrev; -#else // INTEL_SYCL_OPAQUEPOINTER_READY - if (PTy->isOpaque()) { - // OPAQUE_POINTER: [address space] - Code = bitc::TYPE_CODE_OPAQUE_POINTER; - TypeVals.push_back(AddressSpace); - if (AddressSpace == 0) - AbbrevToUse = OpaquePtrAbbrev; - } else { - // POINTER: [pointee type, address space] - Code = bitc::TYPE_CODE_POINTER; - TypeVals.push_back(VE.getTypeID(PTy->getNonOpaquePointerElementType())); - TypeVals.push_back(AddressSpace); - } -#endif // INTEL_SYCL_OPAQUEPOINTER_READY break; } case Type::FunctionTyID: { diff --git a/llvm/lib/CodeGen/AtomicExpandPass.cpp b/llvm/lib/CodeGen/AtomicExpandPass.cpp index fba6b44c983f2..70770cfdfe231 100644 --- a/llvm/lib/CodeGen/AtomicExpandPass.cpp +++ b/llvm/lib/CodeGen/AtomicExpandPass.cpp @@ -373,16 +373,8 @@ LoadInst *AtomicExpand::convertAtomicLoadToIntegerType(LoadInst *LI) { ReplacementIRBuilder Builder(LI, *DL); Value *Addr = LI->getPointerOperand(); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Type *PT = PointerType::get(NewTy, Addr->getType()->getPointerAddressSpace()); - Value *NewAddr = Builder.CreateBitCast(Addr, PT); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY auto *NewLI = Builder.CreateLoad(NewTy, Addr); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - auto *NewLI = Builder.CreateLoad(NewTy, NewAddr); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY NewLI->setAlignment(LI->getAlign()); NewLI->setVolatile(LI->isVolatile()); NewLI->setAtomic(LI->getOrdering(), LI->getSyncScopeID()); @@ -404,21 +396,12 @@ AtomicExpand::convertAtomicXchgToIntegerType(AtomicRMWInst *RMWI) { Value *Addr = RMWI->getPointerOperand(); Value *Val = RMWI->getValOperand(); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Type *PT = PointerType::get(NewTy, RMWI->getPointerAddressSpace()); - Value *NewAddr = Builder.CreateBitCast(Addr, PT); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY Value *NewVal = Val->getType()->isPointerTy() ? Builder.CreatePtrToInt(Val, NewTy) : Builder.CreateBitCast(Val, NewTy); - auto *NewRMWI = -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - Builder.CreateAtomicRMW(AtomicRMWInst::Xchg, Addr, NewVal, -#else //INTEL_SYCL_OPAQUEPOINTER_READY - Builder.CreateAtomicRMW(AtomicRMWInst::Xchg, NewAddr, NewVal, -#endif //INTEL_SYCL_OPAQUEPOINTER_READY - RMWI->getAlign(), RMWI->getOrdering()); + auto *NewRMWI = Builder.CreateAtomicRMW( + AtomicRMWInst::Xchg, Addr, NewVal, RMWI->getAlign(), RMWI->getOrdering()); NewRMWI->setVolatile(RMWI->isVolatile()); LLVM_DEBUG(dbgs() << "Replaced " << *RMWI << " with " << *NewRMWI << "\n"); @@ -520,16 +503,8 @@ StoreInst *AtomicExpand::convertAtomicStoreToIntegerType(StoreInst *SI) { Value *NewVal = Builder.CreateBitCast(SI->getValueOperand(), NewTy); Value *Addr = SI->getPointerOperand(); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Type *PT = PointerType::get(NewTy, Addr->getType()->getPointerAddressSpace()); - Value *NewAddr = Builder.CreateBitCast(Addr, PT); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY StoreInst *NewSI = Builder.CreateStore(NewVal, Addr); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - StoreInst *NewSI = Builder.CreateStore(NewVal, NewAddr); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY NewSI->setAlignment(SI->getAlign()); NewSI->setVolatile(SI->isVolatile()); NewSI->setAtomic(SI->getOrdering(), SI->getSyncScopeID()); @@ -1200,20 +1175,12 @@ AtomicExpand::convertCmpXchgToIntegerType(AtomicCmpXchgInst *CI) { ReplacementIRBuilder Builder(CI, *DL); Value *Addr = CI->getPointerOperand(); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Type *PT = PointerType::get(NewTy, Addr->getType()->getPointerAddressSpace()); - Value *NewAddr = Builder.CreateBitCast(Addr, PT); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY Value *NewCmp = Builder.CreatePtrToInt(CI->getCompareOperand(), NewTy); Value *NewNewVal = Builder.CreatePtrToInt(CI->getNewValOperand(), NewTy); auto *NewCI = Builder.CreateAtomicCmpXchg( -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Addr, NewCmp, NewNewVal, CI->getAlign(), CI->getSuccessOrdering(), -#else //INTEL_SYCL_OPAQUEPOINTER_READY - NewAddr, NewCmp, NewNewVal, CI->getAlign(), CI->getSuccessOrdering(), -#endif //INTEL_SYCL_OPAQUEPOINTER_READY CI->getFailureOrdering(), CI->getSyncScopeID()); NewCI->setVolatile(CI->isVolatile()); NewCI->setWeak(CI->isWeak()); diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index 7bf60c0bd9cee..7fc62f28873ff 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -5503,11 +5503,7 @@ bool CodeGenPrepare::optimizeMemoryInst(Instruction *MemoryInst, Value *Addr, return Modified; } else { Type *I8PtrTy = -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Builder.getPtrTy(Addr->getType()->getPointerAddressSpace()); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - Builder.getInt8PtrTy(Addr->getType()->getPointerAddressSpace()); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY Type *I8Ty = Builder.getInt8Ty(); // Start with the base register. Do this first so that subsequent address @@ -6144,11 +6140,7 @@ bool CodeGenPrepare::splitLargeGEPOffsets() { LLVMContext &Ctx = GEP->getContext(); Type *PtrIdxTy = DL->getIndexType(GEP->getType()); Type *I8PtrTy = -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY PointerType::get(Ctx, GEP->getType()->getPointerAddressSpace()); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - Type::getInt8PtrTy(Ctx, GEP->getType()->getPointerAddressSpace()); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY Type *I8Ty = Type::getInt8Ty(Ctx); if (!NewBaseGEP) { diff --git a/llvm/lib/CodeGen/LowerEmuTLS.cpp b/llvm/lib/CodeGen/LowerEmuTLS.cpp index a89c2a41c9690..f3b5069d351b4 100644 --- a/llvm/lib/CodeGen/LowerEmuTLS.cpp +++ b/llvm/lib/CodeGen/LowerEmuTLS.cpp @@ -85,11 +85,7 @@ bool LowerEmuTLS::runOnModule(Module &M) { bool LowerEmuTLS::addEmuTlsVar(Module &M, const GlobalVariable *GV) { LLVMContext &C = M.getContext(); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY PointerType *VoidPtrType = PointerType::getUnqual(C); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - PointerType *VoidPtrType = Type::getInt8PtrTy(C); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY std::string EmuTlsVarName = ("__emutls_v." + GV->getName()).str(); GlobalVariable *EmuTlsVar = M.getNamedGlobal(EmuTlsVarName); @@ -118,12 +114,7 @@ bool LowerEmuTLS::addEmuTlsVar(Module &M, const GlobalVariable *GV) { // void *templ; // 0 or point to __emutls_t.* // sizeof(word) should be the same as sizeof(void*) on target. IntegerType *WordType = DL.getIntPtrType(C); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY PointerType *InitPtrType = PointerType::getUnqual(C); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - PointerType *InitPtrType = InitValue ? - PointerType::getUnqual(InitValue->getType()) : VoidPtrType; -#endif //INTEL_SYCL_OPAQUEPOINTER_READY Type *ElementTypes[4] = {WordType, WordType, VoidPtrType, InitPtrType}; ArrayRef ElementTypeArray(ElementTypes, 4); StructType *EmuTlsVarType = StructType::create(ElementTypeArray); diff --git a/llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp b/llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp index 3951018926137..dcf7960c452dc 100644 --- a/llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp +++ b/llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp @@ -72,9 +72,6 @@ static bool lowerLoadRelative(Function &F) { bool Changed = false; Type *Int32Ty = Type::getInt32Ty(F.getContext()); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Type *Int32PtrTy = Int32Ty->getPointerTo(); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY Type *Int8Ty = Type::getInt8Ty(F.getContext()); for (Use &U : llvm::make_early_inc_range(F.uses())) { @@ -85,12 +82,7 @@ static bool lowerLoadRelative(Function &F) { IRBuilder<> B(CI); Value *OffsetPtr = B.CreateGEP(Int8Ty, CI->getArgOperand(0), CI->getArgOperand(1)); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Value *OffsetI32 = B.CreateAlignedLoad(Int32Ty, OffsetPtr, Align(4)); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - Value *OffsetPtrI32 = B.CreateBitCast(OffsetPtr, Int32PtrTy); - Value *OffsetI32 = B.CreateAlignedLoad(Int32Ty, OffsetPtrI32, Align(4)); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY Value *ResultPtr = B.CreateGEP(Int8Ty, CI->getArgOperand(0), OffsetI32); CI->replaceAllUsesWith(ResultPtr); diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 6424a151d7307..6f978339f6a8a 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -1296,14 +1296,8 @@ SDNode *SelectionDAG::FindModifiedNodeSlot(SDNode *N, ArrayRef Ops, } Align SelectionDAG::getEVTAlign(EVT VT) const { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Type *Ty = VT == MVT::iPTR ? PointerType::get(*getContext(), 0) : VT.getTypeForEVT(*getContext()); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - Type *Ty = VT == MVT::iPTR ? - PointerType::get(Type::getInt8Ty(*getContext()), 0) : - VT.getTypeForEVT(*getContext()); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY return getDataLayout().getABITypeAlign(Ty); } @@ -7847,11 +7841,7 @@ SDValue SelectionDAG::getMemcpy(SDValue Chain, const SDLoc &dl, SDValue Dst, // Emit a library call. TargetLowering::ArgListTy Args; TargetLowering::ArgListEntry Entry; -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Entry.Ty = PointerType::getUnqual(*getContext()); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - Entry.Ty = Type::getInt8PtrTy(*getContext()); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY Entry.Node = Dst; Args.push_back(Entry); Entry.Node = Src; Args.push_back(Entry); @@ -7953,11 +7943,7 @@ SDValue SelectionDAG::getMemmove(SDValue Chain, const SDLoc &dl, SDValue Dst, // Emit a library call. TargetLowering::ArgListTy Args; TargetLowering::ArgListEntry Entry; -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Entry.Ty = PointerType::getUnqual(*getContext()); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - Entry.Ty = Type::getInt8PtrTy(*getContext()); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY Entry.Node = Dst; Args.push_back(Entry); Entry.Node = Src; Args.push_back(Entry); @@ -8084,22 +8070,14 @@ SDValue SelectionDAG::getMemset(SDValue Chain, const SDLoc &dl, SDValue Dst, // If zeroing out and bzero is present, use it. if (isNullConstant(Src) && BzeroName) { TargetLowering::ArgListTy Args; -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Args.push_back(CreateEntry(Dst, PointerType::getUnqual(Ctx))); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - Args.push_back(CreateEntry(Dst, Type::getInt8PtrTy(Ctx))); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY Args.push_back(CreateEntry(Size, DL.getIntPtrType(Ctx))); CLI.setLibCallee( TLI->getLibcallCallingConv(RTLIB::BZERO), Type::getVoidTy(Ctx), getExternalSymbol(BzeroName, TLI->getPointerTy(DL)), std::move(Args)); } else { TargetLowering::ArgListTy Args; -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Args.push_back(CreateEntry(Dst, PointerType::getUnqual(Ctx))); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - Args.push_back(CreateEntry(Dst, Type::getInt8PtrTy(Ctx))); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY Args.push_back(CreateEntry(Src, Src.getValueType().getTypeForEVT(Ctx))); Args.push_back(CreateEntry(Size, DL.getIntPtrType(Ctx))); CLI.setLibCallee(TLI->getLibcallCallingConv(RTLIB::MEMSET), diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 81bda3f1ce4b4..4ca50f2a553af 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -2029,12 +2029,8 @@ void SelectionDAGBuilder::visitRet(const ReturnInst &I) { // registers the usual way. SmallVector PtrValueVTs; ComputeValueVTs(TLI, DL, -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY PointerType::get(F->getContext(), -#else - F->getReturnType()->getPointerTo( -#endif // INTEL_SYCL_OPAQUEPOINTER_READY - DAG.getDataLayout().getAllocaAddrSpace()), + DAG.getDataLayout().getAllocaAddrSpace()), PtrValueVTs); SDValue RetPtr = @@ -2779,11 +2775,7 @@ void SelectionDAGBuilder::visitSPDescriptorParent(StackProtectorDescriptor &SPD, SDValue StackSlotPtr = DAG.getFrameIndex(FI, PtrTy); const Module &M = *ParentBB->getParent()->getFunction().getParent(); Align Align = -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY DAG.getDataLayout().getPrefTypeAlign(PointerType::get(M.getContext(), 0)); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - DAG.getDataLayout().getPrefTypeAlign(Type::getInt8PtrTy(M.getContext())); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY // Generate code to load the content of the guard slot. SDValue GuardVal = DAG.getLoad( @@ -10434,12 +10426,8 @@ TargetLowering::LowerCallTo(TargetLowering::CallLoweringInfo &CLI) const { // The instruction result is the result of loading from the // hidden sret parameter. SmallVector PVTs; -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Type *PtrRetTy = PointerType::get(OrigRetTy->getContext(), DL.getAllocaAddrSpace()); -#else - Type *PtrRetTy = OrigRetTy->getPointerTo(DL.getAllocaAddrSpace()); -#endif ComputeValueVTs(*this, DL, PtrRetTy, PVTs); assert(PVTs.size() == 1 && "Pointers should fit in one register"); @@ -10767,11 +10755,7 @@ void SelectionDAGISel::LowerArguments(const Function &F) { // Put in an sret pointer parameter before all the other parameters. SmallVector ValueVTs; ComputeValueVTs(*TLI, DAG.getDataLayout(), -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY PointerType::get(F.getContext(), -#else // INTEL_SYCL_OPAQUEPOINTER_READY - F.getReturnType()->getPointerTo( -#endif // INTEL_SYCL_OPAQUEPOINTER_READY DAG.getDataLayout().getAllocaAddrSpace()), ValueVTs); @@ -10965,12 +10949,8 @@ void SelectionDAGISel::LowerArguments(const Function &F) { // from the sret argument into it. SmallVector ValueVTs; ComputeValueVTs(*TLI, DAG.getDataLayout(), -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY PointerType::get(F.getContext(), -#else - F.getReturnType()->getPointerTo( -#endif - DAG.getDataLayout().getAllocaAddrSpace()), + DAG.getDataLayout().getAllocaAddrSpace()), ValueVTs); MVT VT = ValueVTs[0].getSimpleVT(); MVT RegVT = TLI->getRegisterType(*CurDAG->getContext(), VT); diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp index 90307ca2a614f..98d7dcb8ec12b 100644 --- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp @@ -430,11 +430,7 @@ int ExecutionEngine::runFunctionAsMain(Function *Fn, // Check main() type unsigned NumArgs = Fn->getFunctionType()->getNumParams(); FunctionType *FTy = Fn->getFunctionType(); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Type *PPInt8Ty = PointerType::get(Fn->getContext(), 0); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - Type *PPInt8Ty = Type::getInt8PtrTy(Fn->getContext())->getPointerTo(); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY // Check the argument types. if (NumArgs > 3) diff --git a/llvm/lib/FuzzMutate/Operations.cpp b/llvm/lib/FuzzMutate/Operations.cpp index 20b5cee12b35d..408f35879acd3 100644 --- a/llvm/lib/FuzzMutate/Operations.cpp +++ b/llvm/lib/FuzzMutate/Operations.cpp @@ -196,13 +196,7 @@ OpDescriptor llvm::fuzzerop::gepDescriptor(unsigned Weight) { auto buildGEP = [](ArrayRef Srcs, Instruction *Inst) { // TODO: It would be better to generate a random type here, rather than // generating a random value and picking its type. -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Type *Ty = Srcs[1]->getType(); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - Type *Ty = Srcs[0]->getType()->isOpaquePointerTy() - ? Srcs[1]->getType() - : Srcs[0]->getType()->getNonOpaquePointerElementType(); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY auto Indices = ArrayRef(Srcs).drop_front(2); return GetElementPtrInst::Create(Ty, Srcs[0], Indices, "G", Inst); }; diff --git a/llvm/lib/FuzzMutate/RandomIRBuilder.cpp b/llvm/lib/FuzzMutate/RandomIRBuilder.cpp index 20c7c931980fc..5569888e5b28e 100644 --- a/llvm/lib/FuzzMutate/RandomIRBuilder.cpp +++ b/llvm/lib/FuzzMutate/RandomIRBuilder.cpp @@ -203,11 +203,7 @@ Value *RandomIRBuilder::newSource(BasicBlock &BB, ArrayRef Insts, RS.sample(Pred.generate(Srcs, KnownTypes)); // If we can find a pointer to load from, use it half the time. -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Value *Ptr = findPointer(BB, Insts); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - Value *Ptr = findPointer(BB, Insts, Srcs, Pred); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY if (Ptr) { // Create load from the chosen pointer auto IP = BB.getFirstInsertionPt(); @@ -215,15 +211,8 @@ Value *RandomIRBuilder::newSource(BasicBlock &BB, ArrayRef Insts, IP = ++I->getIterator(); assert(IP != BB.end() && "guaranteed by the findPointer"); } -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY // Pick the type independently. Type *AccessTy = RS.getSelection()->getType(); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - // For opaque pointers, pick the type independently. - Type *AccessTy = Ptr->getType()->isOpaquePointerTy() - ? RS.getSelection()->getType() - : Ptr->getType()->getNonOpaquePointerElementType(); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY auto *NewLoad = new LoadInst(AccessTy, Ptr, "L", &*IP); // Only sample this load if it really matches the descriptor @@ -374,11 +363,7 @@ Instruction *RandomIRBuilder::connectToSink(BasicBlock &BB, Instruction *RandomIRBuilder::newSink(BasicBlock &BB, ArrayRef Insts, Value *V) { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Value *Ptr = findPointer(BB, Insts); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - Value *Ptr = findPointer(BB, Insts, {V}, matchFirstType()); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY if (!Ptr) { if (uniform(Rand, 0, 1)) { Type *Ty = V->getType(); @@ -391,7 +376,6 @@ Instruction *RandomIRBuilder::newSink(BasicBlock &BB, return new StoreInst(V, Ptr, Insts.back()); } -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Value *RandomIRBuilder::findPointer(BasicBlock &BB, ArrayRef Insts) { auto IsMatchingPtr = [](Instruction *Inst) { @@ -406,35 +390,6 @@ Value *RandomIRBuilder::findPointer(BasicBlock &BB, return RS.getSelection(); return nullptr; } -#else // INTEL_SYCL_OPAQUEPOINTER_READY -Value *RandomIRBuilder::findPointer(BasicBlock &BB, - ArrayRef Insts, - ArrayRef Srcs, SourcePred Pred) { - auto IsMatchingPtr = [&Srcs, &Pred](Instruction *Inst) { - // Invoke instructions sometimes produce valid pointers but currently - // we can't insert loads or stores from them - if (Inst->isTerminator()) - return false; - - if (auto *PtrTy = dyn_cast(Inst->getType())) { - if (PtrTy->isOpaque()) - return true; - - // We can never generate loads from non first class or non sized types - Type *ElemTy = PtrTy->getNonOpaquePointerElementType(); - if (!ElemTy->isSized() || !ElemTy->isFirstClassType()) - return false; - - // TODO: Check if this is horribly expensive. - return Pred.matches(Srcs, UndefValue::get(ElemTy)); - } - return false; - }; - if (auto RS = makeSampler(Rand, make_filter_range(Insts, IsMatchingPtr))) - return RS.getSelection(); - return nullptr; -} -#endif // INTEL_SYCL_OPAQUEPOINTER_READY Type *RandomIRBuilder::randomType() { uint64_t TyIdx = uniform(Rand, 0, KnownTypes.size() - 1); diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp index f7fdff30ff21b..be4a3ed79d88c 100644 --- a/llvm/lib/IR/AsmWriter.cpp +++ b/llvm/lib/IR/AsmWriter.cpp @@ -595,22 +595,9 @@ void TypePrinting::print(Type *Ty, raw_ostream &OS) { } case Type::PointerTyID: { PointerType *PTy = cast(Ty); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY OS << "ptr"; -#else // INTEL_SYCL_OPAQUEPOINTER_READY - if (PTy->isOpaque()) { - OS << "ptr"; - if (unsigned AddressSpace = PTy->getAddressSpace()) - OS << " addrspace(" << AddressSpace << ')'; - return; - } - print(PTy->getNonOpaquePointerElementType(), OS); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY if (unsigned AddressSpace = PTy->getAddressSpace()) OS << " addrspace(" << AddressSpace << ')'; -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - OS << '*'; -#endif // INTEL_SYCL_OPAQUEPOINTER_READY return; } case Type::ArrayTyID: { diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp index ccab24321bc84..e2a6a5494ecb7 100644 --- a/llvm/lib/IR/AutoUpgrade.cpp +++ b/llvm/lib/IR/AutoUpgrade.cpp @@ -1290,25 +1290,15 @@ GlobalVariable *llvm::UpgradeGlobalVariable(GlobalVariable *GV) { LLVMContext &C = GV->getContext(); IRBuilder<> IRB(C); auto EltTy = StructType::get(STy->getElementType(0), STy->getElementType(1), -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY IRB.getPtrTy()); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - IRB.getInt8PtrTy()); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY Constant *Init = GV->getInitializer(); unsigned N = Init->getNumOperands(); std::vector NewCtors(N); for (unsigned i = 0; i != N; ++i) { auto Ctor = cast(Init->getOperand(i)); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY NewCtors[i] = ConstantStruct::get(EltTy, Ctor->getAggregateElement(0u), Ctor->getAggregateElement(1), Constant::getNullValue(IRB.getPtrTy())); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - NewCtors[i] = ConstantStruct::get( - EltTy, Ctor->getAggregateElement(0u), Ctor->getAggregateElement(1), - Constant::getNullValue(IRB.getInt8PtrTy())); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY } Constant *NewInit = ConstantArray::get(ArrayType::get(EltTy, N), NewCtors); @@ -4328,11 +4318,7 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) { NewCall = Builder.CreateCall(NewFn, {CI->getArgOperand(0), CI->getArgOperand(1), CI->getArgOperand(2), CI->getArgOperand(3), -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Constant::getNullValue(Builder.getPtrTy())}); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - Constant::getNullValue(Builder.getInt8PtrTy())}); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY NewCall->takeName(CI); CI->replaceAllUsesWith(NewCall); CI->eraseFromParent(); @@ -4348,11 +4334,7 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) { NewCall = Builder.CreateCall(NewFn, {CI->getArgOperand(0), CI->getArgOperand(1), CI->getArgOperand(2), CI->getArgOperand(3), -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Constant::getNullValue(Builder.getPtrTy())}); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - Constant::getNullValue(Builder.getInt8PtrTy())}); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY NewCall->takeName(CI); CI->replaceAllUsesWith(NewCall); CI->eraseFromParent(); diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp index d6261a6b4a34c..d31482480833d 100644 --- a/llvm/lib/IR/ConstantFold.cpp +++ b/llvm/lib/IR/ConstantFold.cpp @@ -111,31 +111,6 @@ static Constant *FoldBitCast(Constant *V, Type *DestTy) { if (SrcTy == DestTy) return V; // no-op cast -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - // Check to see if we are casting a pointer to an aggregate to a pointer to - // the first element. If so, return the appropriate GEP instruction. - if (PointerType *PTy = dyn_cast(V->getType())) - if (PointerType *DPTy = dyn_cast(DestTy)) - if (PTy->getAddressSpace() == DPTy->getAddressSpace() && - !PTy->isOpaque() && !DPTy->isOpaque() && - PTy->getNonOpaquePointerElementType()->isSized()) { - SmallVector IdxList; - Value *Zero = - Constant::getNullValue(Type::getInt32Ty(DPTy->getContext())); - IdxList.push_back(Zero); - Type *ElTy = PTy->getNonOpaquePointerElementType(); - while (ElTy && ElTy != DPTy->getNonOpaquePointerElementType()) { - ElTy = GetElementPtrInst::getTypeAtIndex(ElTy, (uint64_t)0); - IdxList.push_back(Zero); - } - - if (ElTy == DPTy->getNonOpaquePointerElementType()) - // This GEP is inbounds because all indices are zero. - return ConstantExpr::getInBoundsGetElementPtr( - PTy->getNonOpaquePointerElementType(), V, IdxList); - } -#endif //INTEL_SYCL_OPAQUEPOINTER_READY - // Handle casts from one vector constant to another. We know that the src // and dest type have the same size (otherwise its an illegal cast). if (VectorType *DestPTy = dyn_cast(DestTy)) { @@ -1995,13 +1970,8 @@ Constant *llvm::ConstantFoldGetElementPtr(Type *PointeeTy, Constant *C, ArrayRef Idxs) { if (Idxs.empty()) return C; -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Type *GEPTy = GetElementPtrInst::getGEPReturnType( C, ArrayRef((Value *const *)Idxs.data(), Idxs.size())); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - Type *GEPTy = GetElementPtrInst::getGEPReturnType( - PointeeTy, C, ArrayRef((Value *const *)Idxs.data(), Idxs.size())); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY if (isa(C)) return PoisonValue::get(GEPTy); @@ -2011,12 +1981,6 @@ Constant *llvm::ConstantFoldGetElementPtr(Type *PointeeTy, Constant *C, return InBounds ? PoisonValue::get(GEPTy) : UndefValue::get(GEPTy); auto IsNoOp = [&]() { -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - // For non-opaque pointers having multiple indices will change the result - // type of the GEP. - if (!C->getType()->getScalarType()->isOpaquePointerTy() && Idxs.size() != 1) - return false; -#endif //INTEL_SYCL_OPAQUEPOINTER_READY // Avoid losing inrange information. if (InRangeIndex) return false; @@ -2069,36 +2033,6 @@ Constant *llvm::ConstantFoldGetElementPtr(Type *PointeeTy, Constant *C, if (auto *GEP = dyn_cast(CE)) if (Constant *C = foldGEPOfGEP(GEP, PointeeTy, InBounds, Idxs)) return C; -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - // Attempt to fold casts to the same type away. For example, folding: - // - // i32* getelementptr ([2 x i32]* bitcast ([3 x i32]* %X to [2 x i32]*), - // i64 0, i64 0) - // into: - // - // i32* getelementptr ([3 x i32]* %X, i64 0, i64 0) - // - // Don't fold if the cast is changing address spaces. - Constant *Idx0 = cast(Idxs[0]); - if (CE->isCast() && Idxs.size() > 1 && Idx0->isNullValue()) { - PointerType *SrcPtrTy = - dyn_cast(CE->getOperand(0)->getType()); - PointerType *DstPtrTy = dyn_cast(CE->getType()); - if (SrcPtrTy && DstPtrTy && !SrcPtrTy->isOpaque() && - !DstPtrTy->isOpaque()) { - ArrayType *SrcArrayTy = - dyn_cast(SrcPtrTy->getNonOpaquePointerElementType()); - ArrayType *DstArrayTy = - dyn_cast(DstPtrTy->getNonOpaquePointerElementType()); - if (SrcArrayTy && DstArrayTy - && SrcArrayTy->getElementType() == DstArrayTy->getElementType() - && SrcPtrTy->getAddressSpace() == DstPtrTy->getAddressSpace()) - return ConstantExpr::getGetElementPtr(SrcArrayTy, - (Constant *)CE->getOperand(0), - Idxs, InBounds, InRangeIndex); - } - } -#endif //INTEL_SYCL_OPAQUEPOINTER_READY } // Check to see if any array indices are not within the corresponding diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp index faf41d095f0d4..5a56d57bc04ee 100644 --- a/llvm/lib/IR/Constants.cpp +++ b/llvm/lib/IR/Constants.cpp @@ -1770,11 +1770,7 @@ BlockAddress *BlockAddress::get(Function *F, BasicBlock *BB) { } BlockAddress::BlockAddress(Function *F, BasicBlock *BB) -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY : Constant(PointerType::get(F->getContext(), F->getAddressSpace()), -#else // INTEL_SYCL_OPAQUEPOINTER_READY - : Constant(Type::getInt8PtrTy(F->getContext(), F->getAddressSpace()), -#endif // INTEL_SYCL_OPAQUEPOINTER_READY Value::BlockAddressVal, &Op<0>(), 2) { setOperand(0, F); setOperand(1, BB); @@ -2230,22 +2226,6 @@ Constant *ConstantExpr::getAddrSpaceCast(Constant *C, Type *DstTy, bool OnlyIfReduced) { assert(CastInst::castIsValid(Instruction::AddrSpaceCast, C, DstTy) && "Invalid constantexpr addrspacecast!"); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - // Canonicalize addrspacecasts between different pointer types by first - // bitcasting the pointer type and then converting the address space. - PointerType *SrcScalarTy = cast(C->getType()->getScalarType()); - PointerType *DstScalarTy = cast(DstTy->getScalarType()); - if (!SrcScalarTy->hasSameElementTypeAs(DstScalarTy)) { - Type *MidTy = PointerType::getWithSamePointeeType( - DstScalarTy, SrcScalarTy->getAddressSpace()); - if (VectorType *VT = dyn_cast(DstTy)) { - // Handle vectors of pointers. - MidTy = FixedVectorType::get(MidTy, - cast(VT)->getNumElements()); - } - C = getBitCast(C, MidTy); - } -#endif // INTEL_SYCL_OPAQUEPOINTER_READY return getFoldedCast(Instruction::AddrSpaceCast, C, DstTy, OnlyIfReduced); } @@ -2400,9 +2380,6 @@ Constant *ConstantExpr::getGetElementPtr(Type *Ty, Constant *C, ArrayRef Idxs, bool InBounds, std::optional InRangeIndex, Type *OnlyIfReducedTy) { -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - PointerType *OrigPtrTy = cast(C->getType()->getScalarType()); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY assert(Ty && "Must specify element type"); assert(isSupportedGetElementPtr(Ty) && "Element type is unsupported!"); @@ -2410,42 +2387,17 @@ Constant *ConstantExpr::getGetElementPtr(Type *Ty, Constant *C, ConstantFoldGetElementPtr(Ty, C, InBounds, InRangeIndex, Idxs)) return FC; // Fold a few common cases. -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - assert(GetElementPtrInst::getIndexedType(Ty, Idxs) && - "GEP indices invalid!");; -#endif // INTEL_SYCL_OPAQUEPOINTER_READY + assert(GetElementPtrInst::getIndexedType(Ty, Idxs) && "GEP indices invalid!"); + ; // Get the result type of the getelementptr! -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Type *ReqTy = GetElementPtrInst::getGEPReturnType(C, Idxs); if (OnlyIfReducedTy == ReqTy) return nullptr; -#else // INTEL_SYCL_OPAQUEPOINTER_READY - Type *DestTy = GetElementPtrInst::getIndexedType(Ty, Idxs); - assert(DestTy && "GEP indices invalid!"); - unsigned AS = OrigPtrTy->getAddressSpace(); - Type *ReqTy = OrigPtrTy->isOpaque() - ? PointerType::get(OrigPtrTy->getContext(), AS) - : DestTy->getPointerTo(AS); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY auto EltCount = ElementCount::getFixed(0); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY if (VectorType *VecTy = dyn_cast(ReqTy)) EltCount = VecTy->getElementCount(); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - if (VectorType *VecTy = dyn_cast(C->getType())) - EltCount = VecTy->getElementCount(); - else - for (auto *Idx : Idxs) - if (VectorType *VecTy = dyn_cast(Idx->getType())) - EltCount = VecTy->getElementCount(); - - if (EltCount.isNonZero()) - ReqTy = VectorType::get(ReqTy, EltCount); - if (OnlyIfReducedTy == ReqTy) - return nullptr; -#endif // INTEL_SYCL_OPAQUEPOINTER_READY // Look up the constant in the table first to ensure uniqueness std::vector ArgVec; diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp index e429b95d2120f..a095bb53540d3 100644 --- a/llvm/lib/IR/Core.cpp +++ b/llvm/lib/IR/Core.cpp @@ -851,13 +851,7 @@ LLVMTypeRef LLVMPointerType(LLVMTypeRef ElementType, unsigned AddressSpace) { return wrap(PointerType::get(unwrap(ElementType), AddressSpace)); } -LLVMBool LLVMPointerTypeIsOpaque(LLVMTypeRef Ty) { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - return true; -#else // INTEL_SYCL_OPAQUEPOINTER_READY - return unwrap(Ty)->isOpaquePointerTy(); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY -} +LLVMBool LLVMPointerTypeIsOpaque(LLVMTypeRef Ty) { return true; } LLVMTypeRef LLVMVectorType(LLVMTypeRef ElementType, unsigned ElementCount) { return wrap(FixedVectorType::get(unwrap(ElementType), ElementCount)); diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp index d4ffe7bdf7f52..fc3c56c663e27 100644 --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -918,13 +918,6 @@ static std::string getMangledTypeStr(Type *Ty, bool &HasUnnamedType) { std::string Result; if (PointerType *PTyp = dyn_cast(Ty)) { Result += "p" + utostr(PTyp->getAddressSpace()); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - // Opaque pointer doesn't have pointee type information, so we just mangle - // address space for opaque pointer. - if (!PTyp->isOpaque()) - Result += getMangledTypeStr(PTyp->getNonOpaquePointerElementType(), - HasUnnamedType); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY } else if (ArrayType *ATyp = dyn_cast(Ty)) { Result += "a" + utostr(ATyp->getNumElements()) + getMangledTypeStr(ATyp->getElementType(), HasUnnamedType); @@ -1215,26 +1208,6 @@ static void DecodeIITType(unsigned &NextElt, ArrayRef Infos, ArgInfo)); return; } -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - case IIT_PTR_TO_ARG: { - unsigned ArgInfo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]); - OutputTable.push_back(IITDescriptor::get(IITDescriptor::PtrToArgument, - ArgInfo)); - return; - } - case IIT_PTR_TO_ELT: { - unsigned ArgInfo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]); - OutputTable.push_back(IITDescriptor::get(IITDescriptor::PtrToElt, ArgInfo)); - return; - } - case IIT_ANYPTR_TO_ELT: { - unsigned short ArgNo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]); - unsigned short RefNo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]); - OutputTable.push_back( - IITDescriptor::get(IITDescriptor::AnyPtrToElt, ArgNo, RefNo)); - return; - } -#endif // INTEL_SYCL_OPAQUEPOINTER_READY case IIT_VEC_OF_ANYPTRS_TO_ELT: { unsigned short ArgNo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]); unsigned short RefNo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]); @@ -1401,20 +1374,6 @@ static Type *DecodeFixedType(ArrayRef &Infos, return VectorType::get(EltTy, VTy->getElementCount()); return EltTy; } -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - case IITDescriptor::PtrToArgument: { - Type *Ty = Tys[D.getArgumentNumber()]; - return PointerType::getUnqual(Ty); - } - case IITDescriptor::PtrToElt: { - Type *Ty = Tys[D.getArgumentNumber()]; - VectorType *VTy = dyn_cast(Ty); - if (!VTy) - llvm_unreachable("Expected an argument of Vector Type"); - Type *EltTy = VTy->getElementType(); - return PointerType::getUnqual(EltTy); - } -#endif // INTEL_SYCL_OPAQUEPOINTER_READY case IITDescriptor::VecElementArgument: { Type *Ty = Tys[D.getArgumentNumber()]; if (VectorType *VTy = dyn_cast(Ty)) @@ -1430,11 +1389,6 @@ static Type *DecodeFixedType(ArrayRef &Infos, case IITDescriptor::VecOfAnyPtrsToElt: // Return the overloaded type (which determines the pointers address space) return Tys[D.getOverloadArgNumber()]; -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - case IITDescriptor::AnyPtrToElt: - // Return the overloaded type (which determines the pointers address space) - return Tys[D.getOverloadArgNumber()]; -#endif // INTEL_SYCL_OPAQUEPOINTER_READY } llvm_unreachable("unhandled"); } @@ -1663,52 +1617,6 @@ static bool matchIntrinsicType( return matchIntrinsicType(EltTy, Infos, ArgTys, DeferredChecks, IsDeferredCheck); } -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - case IITDescriptor::PtrToArgument: { - if (D.getArgumentNumber() >= ArgTys.size()) - return IsDeferredCheck || DeferCheck(Ty); - Type * ReferenceType = ArgTys[D.getArgumentNumber()]; - PointerType *ThisArgType = dyn_cast(Ty); - return (!ThisArgType || - !ThisArgType->isOpaqueOrPointeeTypeMatches(ReferenceType)); - } - case IITDescriptor::PtrToElt: { - if (D.getArgumentNumber() >= ArgTys.size()) - return IsDeferredCheck || DeferCheck(Ty); - VectorType * ReferenceType = - dyn_cast (ArgTys[D.getArgumentNumber()]); - PointerType *ThisArgType = dyn_cast(Ty); - - if (!ThisArgType || !ReferenceType) - return true; - return !ThisArgType->isOpaqueOrPointeeTypeMatches( - ReferenceType->getElementType()); - } - case IITDescriptor::AnyPtrToElt: { - unsigned RefArgNumber = D.getRefArgNumber(); - if (RefArgNumber >= ArgTys.size()) { - if (IsDeferredCheck) - return true; - // If forward referencing, already add the pointer type and - // defer the checks for later. - ArgTys.push_back(Ty); - return DeferCheck(Ty); - } - - if (!IsDeferredCheck) { - assert(D.getOverloadArgNumber() == ArgTys.size() && - "Table consistency error"); - ArgTys.push_back(Ty); - } - - auto *ReferenceType = dyn_cast(ArgTys[RefArgNumber]); - auto *ThisArgType = dyn_cast(Ty); - if (!ThisArgType || !ReferenceType) - return true; - return !ThisArgType->isOpaqueOrPointeeTypeMatches( - ReferenceType->getElementType()); - } -#endif // INTEL_SYCL_OPAQUEPOINTER_READY case IITDescriptor::VecOfAnyPtrsToElt: { unsigned RefArgNumber = D.getRefArgNumber(); if (RefArgNumber >= ArgTys.size()) { @@ -2003,11 +1911,7 @@ void Function::allocHungoffUselist() { setNumHungOffUseOperands(3); // Initialize the uselist with placeholder operands to allow traversal. -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - auto *CPN = ConstantPointerNull::get(Type::getInt1PtrTy(getContext(), 0)); -#else auto *CPN = ConstantPointerNull::get(PointerType::get(getContext(), 0)); -#endif Op<0>().set(CPN); Op<1>().set(CPN); Op<2>().set(CPN); @@ -2019,12 +1923,7 @@ void Function::setHungoffOperand(Constant *C) { allocHungoffUselist(); Op().set(C); } else if (getNumOperands()) { -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Op().set( - ConstantPointerNull::get(Type::getInt1PtrTy(getContext(), 0))); -#else Op().set(ConstantPointerNull::get(PointerType::get(getContext(), 0))); -#endif } } diff --git a/llvm/lib/IR/IRBuilder.cpp b/llvm/lib/IR/IRBuilder.cpp index 064e04dcb96c0..efa49ad2322d1 100644 --- a/llvm/lib/IR/IRBuilder.cpp +++ b/llvm/lib/IR/IRBuilder.cpp @@ -59,16 +59,6 @@ Type *IRBuilderBase::getCurrentFunctionReturnType() const { assert(BB && BB->getParent() && "No current function!"); return BB->getParent()->getReturnType(); } -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY -Value *IRBuilderBase::getCastedInt8PtrValue(Value *Ptr) { - auto *PT = cast(Ptr->getType()); - if (PT->isOpaqueOrPointeeTypeMatches(getInt8Ty())) - return Ptr; - - // Otherwise, we need to insert a bitcast. - return CreateBitCast(Ptr, getInt8PtrTy(PT->getAddressSpace())); -} -#endif DebugLoc IRBuilderBase::getCurrentDebugLocation() const { for (auto &KV : MetadataToCopy) @@ -148,9 +138,6 @@ CallInst *IRBuilderBase::CreateMemSet(Value *Ptr, Value *Val, Value *Size, MaybeAlign Align, bool isVolatile, MDNode *TBAATag, MDNode *ScopeTag, MDNode *NoAliasTag) { -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Ptr = getCastedInt8PtrValue(Ptr); -#endif Value *Ops[] = {Ptr, Val, Size, getInt1(isVolatile)}; Type *Tys[] = { Ptr->getType(), Size->getType() }; Module *M = BB->getParent()->getParent(); @@ -179,9 +166,6 @@ CallInst *IRBuilderBase::CreateMemSetInline(Value *Dst, MaybeAlign DstAlign, bool IsVolatile, MDNode *TBAATag, MDNode *ScopeTag, MDNode *NoAliasTag) { -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Dst = getCastedInt8PtrValue(Dst); -#endif Value *Ops[] = {Dst, Val, Size, getInt1(IsVolatile)}; Type *Tys[] = {Dst->getType(), Size->getType()}; Module *M = BB->getParent()->getParent(); @@ -208,9 +192,6 @@ CallInst *IRBuilderBase::CreateMemSetInline(Value *Dst, MaybeAlign DstAlign, CallInst *IRBuilderBase::CreateElementUnorderedAtomicMemSet( Value *Ptr, Value *Val, Value *Size, Align Alignment, uint32_t ElementSize, MDNode *TBAATag, MDNode *ScopeTag, MDNode *NoAliasTag) { -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Ptr = getCastedInt8PtrValue(Ptr); -#endif Value *Ops[] = {Ptr, Val, Size, getInt32(ElementSize)}; Type *Tys[] = {Ptr->getType(), Size->getType()}; Module *M = BB->getParent()->getParent(); @@ -242,10 +223,6 @@ CallInst *IRBuilderBase::CreateMemTransferInst( IntrID == Intrinsic::memmove) && "Unexpected intrinsic ID"); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Dst = getCastedInt8PtrValue(Dst); - Src = getCastedInt8PtrValue(Src); -#endif Value *Ops[] = {Dst, Src, Size, getInt1(isVolatile)}; Type *Tys[] = { Dst->getType(), Src->getType(), Size->getType() }; Module *M = BB->getParent()->getParent(); @@ -284,10 +261,6 @@ CallInst *IRBuilderBase::CreateElementUnorderedAtomicMemCpy( "Pointer alignment must be at least element size"); assert(SrcAlign >= ElementSize && "Pointer alignment must be at least element size"); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Dst = getCastedInt8PtrValue(Dst); - Src = getCastedInt8PtrValue(Src); -#endif Value *Ops[] = {Dst, Src, Size, getInt32(ElementSize)}; Type *Tys[] = {Dst->getType(), Src->getType(), Size->getType()}; @@ -327,10 +300,6 @@ CallInst *IRBuilderBase::CreateElementUnorderedAtomicMemMove( "Pointer alignment must be at least element size"); assert(SrcAlign >= ElementSize && "Pointer alignment must be at least element size"); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Dst = getCastedInt8PtrValue(Dst); - Src = getCastedInt8PtrValue(Src); -#endif Value *Ops[] = {Dst, Src, Size, getInt32(ElementSize)}; Type *Tys[] = {Dst->getType(), Src->getType(), Size->getType()}; @@ -436,9 +405,6 @@ CallInst *IRBuilderBase::CreateFPMinimumReduce(Value *Src) { CallInst *IRBuilderBase::CreateLifetimeStart(Value *Ptr, ConstantInt *Size) { assert(isa(Ptr->getType()) && "lifetime.start only applies to pointers."); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Ptr = getCastedInt8PtrValue(Ptr); -#endif if (!Size) Size = getInt64(-1); else @@ -454,9 +420,6 @@ CallInst *IRBuilderBase::CreateLifetimeStart(Value *Ptr, ConstantInt *Size) { CallInst *IRBuilderBase::CreateLifetimeEnd(Value *Ptr, ConstantInt *Size) { assert(isa(Ptr->getType()) && "lifetime.end only applies to pointers."); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Ptr = getCastedInt8PtrValue(Ptr); -#endif if (!Size) Size = getInt64(-1); else @@ -473,9 +436,6 @@ CallInst *IRBuilderBase::CreateInvariantStart(Value *Ptr, ConstantInt *Size) { assert(isa(Ptr->getType()) && "invariant.start only applies to pointers."); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Ptr = getCastedInt8PtrValue(Ptr); -#endif if (!Size) Size = getInt64(-1); else @@ -555,9 +515,6 @@ CallInst *IRBuilderBase::CreateMaskedLoad(Type *Ty, Value *Ptr, Align Alignment, const Twine &Name) { auto *PtrTy = cast(Ptr->getType()); assert(Ty->isVectorTy() && "Type should be vector"); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - assert(PtrTy->isOpaqueOrPointeeTypeMatches(Ty) && "Wrong element type"); -#endif assert(Mask && "Mask should not be all-ones (null)"); if (!PassThru) PassThru = PoisonValue::get(Ty); @@ -578,9 +535,6 @@ CallInst *IRBuilderBase::CreateMaskedStore(Value *Val, Value *Ptr, auto *PtrTy = cast(Ptr->getType()); Type *DataTy = Val->getType(); assert(DataTy->isVectorTy() && "Val should be a vector"); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - assert(PtrTy->isOpaqueOrPointeeTypeMatches(DataTy) && "Wrong element type"); -#endif assert(Mask && "Mask should not be all-ones (null)"); Type *OverloadedTypes[] = { DataTy, PtrTy }; Value *Ops[] = {Val, Ptr, getInt32(Alignment.value()), Mask}; @@ -615,12 +569,6 @@ CallInst *IRBuilderBase::CreateMaskedGather(Type *Ty, Value *Ptrs, auto *VecTy = cast(Ty); ElementCount NumElts = VecTy->getElementCount(); auto *PtrsTy = cast(Ptrs->getType()); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - assert(cast(PtrsTy->getElementType()) - ->isOpaqueOrPointeeTypeMatches( - cast(Ty)->getElementType()) && - "Element type mismatch"); -#endif assert(NumElts == PtrsTy->getElementCount() && "Element count mismatch"); if (!Mask) @@ -651,15 +599,6 @@ CallInst *IRBuilderBase::CreateMaskedScatter(Value *Data, Value *Ptrs, auto *DataTy = cast(Data->getType()); ElementCount NumElts = PtrsTy->getElementCount(); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY -#ifndef NDEBUG - auto *PtrTy = cast(PtrsTy->getElementType()); - assert(NumElts == DataTy->getElementCount() && - PtrTy->isOpaqueOrPointeeTypeMatches(DataTy->getElementType()) && - "Incompatible pointer and data types"); -#endif -#endif - if (!Mask) Mask = getAllOnesMask(NumElts); @@ -682,16 +621,7 @@ CallInst *IRBuilderBase::CreateMaskedScatter(Value *Data, Value *Ptrs, CallInst *IRBuilderBase::CreateMaskedExpandLoad(Type *Ty, Value *Ptr, Value *Mask, Value *PassThru, const Twine &Name) { -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - auto *PtrTy = cast(Ptr->getType()); -#endif assert(Ty->isVectorTy() && "Type should be vector"); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - assert(PtrTy->isOpaqueOrPointeeTypeMatches( - cast(Ty)->getElementType()) && - "Wrong element type"); - (void)PtrTy; -#endif assert(Mask && "Mask should not be all-ones (null)"); if (!PassThru) PassThru = PoisonValue::get(Ty); @@ -708,17 +638,8 @@ CallInst *IRBuilderBase::CreateMaskedExpandLoad(Type *Ty, Value *Ptr, /// be accessed in memory CallInst *IRBuilderBase::CreateMaskedCompressStore(Value *Val, Value *Ptr, Value *Mask) { -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - auto *PtrTy = cast(Ptr->getType()); -#endif Type *DataTy = Val->getType(); assert(DataTy->isVectorTy() && "Val should be a vector"); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - assert(PtrTy->isOpaqueOrPointeeTypeMatches( - cast(DataTy)->getElementType()) && - "Wrong element type"); - (void)PtrTy; -#endif assert(Mask && "Mask should not be all-ones (null)"); Type *OverloadedTypes[] = {DataTy}; Value *Ops[] = {Val, Ptr, Mask}; @@ -1139,11 +1060,6 @@ Value *IRBuilderBase::CreatePtrDiff(Type *ElemTy, Value *LHS, Value *RHS, const Twine &Name) { assert(LHS->getType() == RHS->getType() && "Pointer subtraction operand types must match!"); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - assert(cast(LHS->getType()) - ->isOpaqueOrPointeeTypeMatches(ElemTy) && - "Pointer type must match element type"); -#endif Value *LHS_int = CreatePtrToInt(LHS, Type::getInt64Ty(Context)); Value *RHS_int = CreatePtrToInt(RHS, Type::getInt64Ty(Context)); Value *Difference = CreateSub(LHS_int, RHS_int); @@ -1156,27 +1072,7 @@ Value *IRBuilderBase::CreateLaunderInvariantGroup(Value *Ptr) { "launder.invariant.group only applies to pointers."); // FIXME: we could potentially avoid casts to/from i8*. auto *PtrType = Ptr->getType(); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - auto *Int8PtrTy = getInt8PtrTy(PtrType->getPointerAddressSpace()); - if (PtrType != Int8PtrTy) - Ptr = CreateBitCast(Ptr, Int8PtrTy); -#endif Module *M = BB->getParent()->getParent(); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Function *FnLaunderInvariantGroup = Intrinsic::getDeclaration( - M, Intrinsic::launder_invariant_group, {Int8PtrTy}); - - assert(FnLaunderInvariantGroup->getReturnType() == Int8PtrTy && - FnLaunderInvariantGroup->getFunctionType()->getParamType(0) == - Int8PtrTy && - "LaunderInvariantGroup should take and return the same type"); - - CallInst *Fn = CreateCall(FnLaunderInvariantGroup, {Ptr}); - - if (PtrType != Int8PtrTy) - return CreateBitCast(Fn, PtrType); - return Fn; -#else Function *FnLaunderInvariantGroup = Intrinsic::getDeclaration( M, Intrinsic::launder_invariant_group, {PtrType}); @@ -1186,7 +1082,6 @@ Value *IRBuilderBase::CreateLaunderInvariantGroup(Value *Ptr) { "LaunderInvariantGroup should take and return the same type"); return CreateCall(FnLaunderInvariantGroup, {Ptr}); -#endif } Value *IRBuilderBase::CreateStripInvariantGroup(Value *Ptr) { @@ -1195,27 +1090,7 @@ Value *IRBuilderBase::CreateStripInvariantGroup(Value *Ptr) { // FIXME: we could potentially avoid casts to/from i8*. auto *PtrType = Ptr->getType(); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - auto *Int8PtrTy = getInt8PtrTy(PtrType->getPointerAddressSpace()); - if (PtrType != Int8PtrTy) - Ptr = CreateBitCast(Ptr, Int8PtrTy); -#endif Module *M = BB->getParent()->getParent(); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Function *FnStripInvariantGroup = Intrinsic::getDeclaration( - M, Intrinsic::strip_invariant_group, {Int8PtrTy}); - - assert(FnStripInvariantGroup->getReturnType() == Int8PtrTy && - FnStripInvariantGroup->getFunctionType()->getParamType(0) == - Int8PtrTy && - "StripInvariantGroup should take and return the same type"); - - CallInst *Fn = CreateCall(FnStripInvariantGroup, {Ptr}); - - if (PtrType != Int8PtrTy) - return CreateBitCast(Fn, PtrType); - return Fn; -#else Function *FnStripInvariantGroup = Intrinsic::getDeclaration( M, Intrinsic::strip_invariant_group, {PtrType}); @@ -1225,7 +1100,6 @@ Value *IRBuilderBase::CreateStripInvariantGroup(Value *Ptr) { "StripInvariantGroup should take and return the same type"); return CreateCall(FnStripInvariantGroup, {Ptr}); -#endif } Value *IRBuilderBase::CreateVectorReverse(Value *V, const Twine &Name) { @@ -1298,22 +1172,13 @@ Value *IRBuilderBase::CreatePreserveArrayAccessIndex( auto *BaseType = Base->getType(); assert(isa(BaseType) && "Invalid Base ptr type for preserve.array.access.index."); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - assert(cast(BaseType)->isOpaqueOrPointeeTypeMatches(ElTy) && - "Pointer element type mismatch"); -#endif Value *LastIndexV = getInt32(LastIndex); Constant *Zero = ConstantInt::get(Type::getInt32Ty(Context), 0); SmallVector IdxList(Dimension, Zero); IdxList.push_back(LastIndexV); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Type *ResultType = GetElementPtrInst::getGEPReturnType(Base, IdxList); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - Type *ResultType = - GetElementPtrInst::getGEPReturnType(ElTy, Base, IdxList); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY Module *M = BB->getParent()->getParent(); Function *FnPreserveArrayAccessIndex = Intrinsic::getDeclaration( @@ -1355,20 +1220,11 @@ Value *IRBuilderBase::CreatePreserveStructAccessIndex( auto *BaseType = Base->getType(); assert(isa(BaseType) && "Invalid Base ptr type for preserve.struct.access.index."); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - assert(cast(BaseType)->isOpaqueOrPointeeTypeMatches(ElTy) && - "Pointer element type mismatch"); -#endif Value *GEPIndex = getInt32(Index); Constant *Zero = ConstantInt::get(Type::getInt32Ty(Context), 0); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Type *ResultType = GetElementPtrInst::getGEPReturnType(Base, {Zero, GEPIndex}); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - Type *ResultType = - GetElementPtrInst::getGEPReturnType(ElTy, Base, {Zero, GEPIndex}); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY Module *M = BB->getParent()->getParent(); Function *FnPreserveStructAccessIndex = Intrinsic::getDeclaration( diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp index 35f81d6564cea..544581b3e1bf3 100644 --- a/llvm/lib/IR/Instructions.cpp +++ b/llvm/lib/IR/Instructions.cpp @@ -3449,21 +3449,9 @@ unsigned CastInst::isEliminableCastPair( "Illegal addrspacecast, bitcast sequence!"); // Allowed, use first cast's opcode return firstOp; -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY case 14: // bitcast, addrspacecast -> addrspacecast return Instruction::AddrSpaceCast; -#else // INTEL_SYCL_OPAQUEPOINTER_READY - case 14: { - // bitcast, addrspacecast -> addrspacecast if the element type of - // bitcast's source is the same as that of addrspacecast's destination. - PointerType *SrcPtrTy = cast(SrcTy->getScalarType()); - PointerType *DstPtrTy = cast(DstTy->getScalarType()); - if (SrcPtrTy->hasSameElementTypeAs(DstPtrTy)) - return Instruction::AddrSpaceCast; - return 0; - } -#endif // INTEL_SYCL_OPAQUEPOINTER_READY case 15: // FIXME: this state can be merged with (1), but the following assert // is useful to check the correcteness of the sequence due to semantic diff --git a/llvm/lib/IR/LLVMContext.cpp b/llvm/lib/IR/LLVMContext.cpp index 991bccd47b69e..e6795c56b3fc4 100644 --- a/llvm/lib/IR/LLVMContext.cpp +++ b/llvm/lib/IR/LLVMContext.cpp @@ -373,23 +373,8 @@ std::unique_ptr LLVMContext::getDiagnosticHandler() { return std::move(pImpl->DiagHandler); } -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY -bool LLVMContext::hasSetOpaquePointersValue() const { - return pImpl->hasOpaquePointersValue(); -} -#endif void LLVMContext::setOpaquePointers(bool Enable) const { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY assert(Enable && "Cannot disable opaque pointers"); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - pImpl->setOpaquePointers(Enable); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY } -bool LLVMContext::supportsTypedPointers() const { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - return false; -#else // INTEL_SYCL_OPAQUEPOINTER_READY - return !pImpl->getOpaquePointers(); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY -} +bool LLVMContext::supportsTypedPointers() const { return false; } diff --git a/llvm/lib/IR/LLVMContextImpl.cpp b/llvm/lib/IR/LLVMContextImpl.cpp index a138536a18c66..fc3f4597fa14d 100644 --- a/llvm/lib/IR/LLVMContextImpl.cpp +++ b/llvm/lib/IR/LLVMContextImpl.cpp @@ -33,18 +33,6 @@ using namespace llvm; -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY -#if ENABLE_OPAQUE_POINTERS -static cl::opt OpaquePointersCL("opaque-pointers", - cl::desc("Use opaque pointers"), - cl::init(true)); -#else // ENABLE_OPAQUE_POINTERS -static cl::opt OpaquePointersCL("opaque-pointers", - cl::desc("Use opaque pointers"), - cl::init(false)); -#endif // ENABLE_OPAQUE_POINTERS -#endif // INTEL_SYCL_OPAQUEPOINTER_READY - LLVMContextImpl::LLVMContextImpl(LLVMContext &C) : DiagHandler(std::make_unique()), VoidTy(C, Type::VoidTyID), LabelTy(C, Type::LabelTyID), @@ -54,13 +42,7 @@ LLVMContextImpl::LLVMContextImpl(LLVMContext &C) X86_FP80Ty(C, Type::X86_FP80TyID), FP128Ty(C, Type::FP128TyID), PPC_FP128Ty(C, Type::PPC_FP128TyID), X86_MMXTy(C, Type::X86_MMXTyID), X86_AMXTy(C, Type::X86_AMXTyID), Int1Ty(C, 1), Int8Ty(C, 8), - Int16Ty(C, 16), Int32Ty(C, 32), Int64Ty(C, 64), Int128Ty(C, 128) { -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - if (OpaquePointersCL.getNumOccurrences()) { - OpaquePointers = OpaquePointersCL; - } -#endif // INTEL_SYCL_OPAQUEPOINTER_READY -} + Int16Ty(C, 16), Int32Ty(C, 32), Int64Ty(C, 64), Int128Ty(C, 128) {} LLVMContextImpl::~LLVMContextImpl() { // NOTE: We need to delete the contents of OwnedModules, but Module's dtor @@ -257,23 +239,4 @@ OptPassGate &LLVMContextImpl::getOptPassGate() const { return *OPG; } -void LLVMContextImpl::setOptPassGate(OptPassGate& OPG) { - this->OPG = &OPG; -} -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY -bool LLVMContextImpl::hasOpaquePointersValue() { - return OpaquePointers.has_value(); -} - -bool LLVMContextImpl::getOpaquePointers() { - if (LLVM_UNLIKELY(!OpaquePointers)) - OpaquePointers = OpaquePointersCL; - return *OpaquePointers; -} - -void LLVMContextImpl::setOpaquePointers(bool OP) { - assert((!OpaquePointers || *OpaquePointers == OP) && - "Cannot change opaque pointers mode once set"); - OpaquePointers = OP; -} -#endif // INTEL_SYCL_OPAQUEPOINTER_READY +void LLVMContextImpl::setOptPassGate(OptPassGate &OPG) { this->OPG = &OPG; } diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h index ee8a7669e7032..4cc3f8da6b75b 100644 --- a/llvm/lib/IR/LLVMContextImpl.h +++ b/llvm/lib/IR/LLVMContextImpl.h @@ -1633,17 +1633,6 @@ class LLVMContextImpl { /// The lifetime of the object must be guaranteed to extend as long as the /// LLVMContext is used by compilation. void setOptPassGate(OptPassGate &); - -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - // TODO: clean up the following after we no longer support non-opaque pointer - // types. - bool getOpaquePointers(); - bool hasOpaquePointersValue(); - void setOpaquePointers(bool OP); - -private: - std::optional OpaquePointers; -#endif // INTEL_SYCL_OPAQUEPOINTER_READY }; } // end namespace llvm diff --git a/llvm/lib/IR/Type.cpp b/llvm/lib/IR/Type.cpp index 95aa76e2b4354..b1d3171f11e07 100644 --- a/llvm/lib/IR/Type.cpp +++ b/llvm/lib/IR/Type.cpp @@ -57,14 +57,6 @@ bool Type::isIntegerTy(unsigned Bitwidth) const { return isIntegerTy() && cast(this)->getBitWidth() == Bitwidth; } -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY -bool Type::isOpaquePointerTy() const { - if (auto *PTy = dyn_cast(this)) - return PTy->isOpaque(); - return false; -} -#endif // INTEL_SYCL_OPAQUEPOINTER_READY - bool Type::isScalableTy() const { if (const auto *STy = dyn_cast(this)) { SmallPtrSet Visited; @@ -262,70 +254,8 @@ IntegerType *Type::getIntNTy(LLVMContext &C, unsigned N) { return IntegerType::get(C, N); } -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY -PointerType *Type::getHalfPtrTy(LLVMContext &C, unsigned AS) { - return getHalfTy(C)->getPointerTo(AS); -} - -PointerType *Type::getBFloatPtrTy(LLVMContext &C, unsigned AS) { - return getBFloatTy(C)->getPointerTo(AS); -} - -PointerType *Type::getFloatPtrTy(LLVMContext &C, unsigned AS) { - return getFloatTy(C)->getPointerTo(AS); -} - -PointerType *Type::getDoublePtrTy(LLVMContext &C, unsigned AS) { - return getDoubleTy(C)->getPointerTo(AS); -} - -PointerType *Type::getX86_FP80PtrTy(LLVMContext &C, unsigned AS) { - return getX86_FP80Ty(C)->getPointerTo(AS); -} - -PointerType *Type::getFP128PtrTy(LLVMContext &C, unsigned AS) { - return getFP128Ty(C)->getPointerTo(AS); -} - -PointerType *Type::getPPC_FP128PtrTy(LLVMContext &C, unsigned AS) { - return getPPC_FP128Ty(C)->getPointerTo(AS); -} - -PointerType *Type::getX86_MMXPtrTy(LLVMContext &C, unsigned AS) { - return getX86_MMXTy(C)->getPointerTo(AS); -} - -PointerType *Type::getX86_AMXPtrTy(LLVMContext &C, unsigned AS) { - return getX86_AMXTy(C)->getPointerTo(AS); -} - -PointerType *Type::getIntNPtrTy(LLVMContext &C, unsigned N, unsigned AS) { - return getIntNTy(C, N)->getPointerTo(AS); -} - -PointerType *Type::getInt1PtrTy(LLVMContext &C, unsigned AS) { - return getInt1Ty(C)->getPointerTo(AS); -} - -#endif //INTEL_SYCL_OPAQUEPOINTER_READY PointerType *Type::getInt8PtrTy(LLVMContext &C, unsigned AS) { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY return PointerType::get(C, AS); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - return getInt8Ty(C)->getPointerTo(AS); -} - -PointerType *Type::getInt16PtrTy(LLVMContext &C, unsigned AS) { - return getInt16Ty(C)->getPointerTo(AS); -} - -PointerType *Type::getInt32PtrTy(LLVMContext &C, unsigned AS) { - return getInt32Ty(C)->getPointerTo(AS); -} - -PointerType *Type::getInt64PtrTy(LLVMContext &C, unsigned AS) { - return getInt64Ty(C)->getPointerTo(AS); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY } Type *Type::getWasm_ExternrefTy(LLVMContext &C) { @@ -805,31 +735,12 @@ ScalableVectorType *ScalableVectorType::get(Type *ElementType, PointerType *PointerType::get(Type *EltTy, unsigned AddressSpace) { assert(EltTy && "Can't get a pointer to type!"); assert(isValidElementType(EltTy) && "Invalid type for pointer element!"); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY // Automatically convert typed pointers to opaque pointers. return get(EltTy->getContext(), AddressSpace); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - LLVMContextImpl *CImpl = EltTy->getContext().pImpl; - - // Automatically convert typed pointers to opaque pointers. - if (CImpl->getOpaquePointers()) - return get(EltTy->getContext(), AddressSpace); - - PointerType *&Entry = - CImpl->LegacyPointerTypes[std::make_pair(EltTy, AddressSpace)]; - - if (!Entry) - Entry = new (CImpl->Alloc) PointerType(EltTy, AddressSpace); - return Entry; -#endif // INTEL_SYCL_OPAQUEPOINTER_READY } PointerType *PointerType::get(LLVMContext &C, unsigned AddressSpace) { LLVMContextImpl *CImpl = C.pImpl; -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - assert(CImpl->getOpaquePointers() && - "Can only create opaque pointers in opaque pointer mode"); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY // Since AddressSpace #0 is the common case, we special case it. PointerType *&Entry = AddressSpace == 0 ? CImpl->AS0PointerType @@ -840,21 +751,8 @@ PointerType *PointerType::get(LLVMContext &C, unsigned AddressSpace) { return Entry; } -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY -PointerType::PointerType(Type *E, unsigned AddrSpace) - : Type(E->getContext(), PointerTyID), PointeeTy(E) { - ContainedTys = &PointeeTy; - NumContainedTys = 1; - setSubclassData(AddrSpace); -} -#endif // INTEL_SYCL_OPAQUEPOINTER_READY - PointerType::PointerType(LLVMContext &C, unsigned AddrSpace) -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY : Type(C, PointerTyID) { -#else // INTEL_SYCL_OPAQUEPOINTER_READY - : Type(C, PointerTyID), PointeeTy(nullptr) { -#endif // INTEL_SYCL_OPAQUEPOINTER_READY setSubclassData(AddrSpace); } @@ -936,11 +834,7 @@ static TargetTypeInfo getTargetTypeInfo(const TargetExtType *Ty) { LLVMContext &C = Ty->getContext(); StringRef Name = Ty->getName(); if (Name.startswith("spirv.")) -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY return TargetTypeInfo(PointerType::get(C, 0), TargetExtType::HasZeroInit, -#else // INTEL_SYCL_OPAQUEPOINTER_READY - return TargetTypeInfo(Type::getInt8PtrTy(C, 0), TargetExtType::HasZeroInit, -#endif // INTEL_SYCL_OPAQUEPOINTER_READY TargetExtType::CanBeGlobal); // Opaque types in the AArch64 name space. diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index 4e2c2e09db226..28a304a9bec29 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -796,12 +796,7 @@ void Verifier::visitGlobalVariable(const GlobalVariable &GV) { if (ArrayType *ATy = dyn_cast(GV.getValueType())) { StructType *STy = dyn_cast(ATy->getElementType()); PointerType *FuncPtrTy = -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY PointerType::get(Context, DL.getProgramAddressSpace()); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - FunctionType::get(Type::getVoidTy(Context), false) - ->getPointerTo(DL.getProgramAddressSpace()); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY Check(STy && (STy->getNumElements() == 2 || STy->getNumElements() == 3) && STy->getTypeAtIndex(0u)->isIntegerTy(32) && STy->getTypeAtIndex(1) == FuncPtrTy, @@ -810,15 +805,8 @@ void Verifier::visitGlobalVariable(const GlobalVariable &GV) { "the third field of the element type is mandatory, " "specify ptr null to migrate from the obsoleted 2-field form"); Type *ETy = STy->getTypeAtIndex(2); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Check(ETy->isPointerTy(), "wrong type for intrinsic global variable", &GV); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - Type *Int8Ty = Type::getInt8Ty(ETy->getContext()); - Check(ETy->isPointerTy() && - cast(ETy)->isOpaqueOrPointeeTypeMatches(Int8Ty), - "wrong type for intrinsic global variable", &GV); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY } } @@ -1957,11 +1945,7 @@ void Verifier::verifyParameterAttrs(AttributeSet Attrs, Type *Ty, } } -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY if (isa(Ty)) { -#else // INTEL_SYCL_OPAQUEPOINTER_READY - if (PointerType *PTy = dyn_cast(Ty)) { -#endif // INTEL_SYCL_OPAQUEPOINTER_READY if (Attrs.hasAttribute(Attribute::ByVal)) { if (Attrs.hasAttribute(Attribute::Alignment)) { Align AttrAlign = Attrs.getAlignment().valueOrOne(); @@ -1988,43 +1972,7 @@ void Verifier::verifyParameterAttrs(AttributeSet Attrs, Type *Ty, Check(Attrs.getPreallocatedType()->isSized(&Visited), "Attribute 'preallocated' does not support unsized types!", V); } -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - if (!PTy->isOpaque()) { - if (!isa(PTy->getNonOpaquePointerElementType())) - Check(!Attrs.hasAttribute(Attribute::SwiftError), - "Attribute 'swifterror' only applies to parameters " - "with pointer to pointer type!", - V); - if (Attrs.hasAttribute(Attribute::ByRef)) { - Check(Attrs.getByRefType() == PTy->getNonOpaquePointerElementType(), - "Attribute 'byref' type does not match parameter!", V); - } - - if (Attrs.hasAttribute(Attribute::ByVal) && Attrs.getByValType()) { - Check(Attrs.getByValType() == PTy->getNonOpaquePointerElementType(), - "Attribute 'byval' type does not match parameter!", V); - } - - if (Attrs.hasAttribute(Attribute::Preallocated)) { - Check(Attrs.getPreallocatedType() == - PTy->getNonOpaquePointerElementType(), - "Attribute 'preallocated' type does not match parameter!", V); - } - - if (Attrs.hasAttribute(Attribute::InAlloca)) { - Check(Attrs.getInAllocaType() == PTy->getNonOpaquePointerElementType(), - "Attribute 'inalloca' type does not match parameter!", V); - } - - if (Attrs.hasAttribute(Attribute::ElementType)) { - Check(Attrs.getElementType() == PTy->getNonOpaquePointerElementType(), - "Attribute 'elementtype' type does not match parameter!", V); - } - } - } -#else } -#endif // INTEL_SYCL_OPAQUEPOINTER_READY if (Attrs.hasAttribute(Attribute::NoFPClass)) { uint64_t Val = Attrs.getAttribute(Attribute::NoFPClass).getValueAsInt(); Check(Val != 0, "Attribute 'nofpclass' must have at least one test bit set", @@ -3315,12 +3263,6 @@ void Verifier::visitPHINode(PHINode &PN) { void Verifier::visitCallBase(CallBase &Call) { Check(Call.getCalledOperand()->getType()->isPointerTy(), "Called function must be a pointer!", Call); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - PointerType *FPTy = cast(Call.getCalledOperand()->getType()); - - Check(FPTy->isOpaqueOrPointeeTypeMatches(Call.getFunctionType()), - "Called function is not the same type as the call!", Call); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY FunctionType *FTy = Call.getFunctionType(); // Verify that the correct number of arguments are being passed @@ -4062,10 +4004,6 @@ void Verifier::visitStoreInst(StoreInst &SI) { PointerType *PTy = dyn_cast(SI.getOperand(1)->getType()); Check(PTy, "Store operand must be a pointer.", &SI); Type *ElTy = SI.getOperand(0)->getType(); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Check(PTy->isOpaqueOrPointeeTypeMatches(ElTy), - "Stored value type does not match pointer operand type!", &SI, ElTy); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY if (MaybeAlign A = SI.getAlign()) { Check(A->value() <= Value::MaximumAlignment, "huge alignment values are unsupported", &SI); @@ -5575,12 +5513,6 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) { Call); Check(Alignment->getValue().isPowerOf2(), "masked_load: alignment must be a power of 2", Call); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Value *Ptr = Call.getArgOperand(0); - PointerType *PtrTy = cast(Ptr->getType()); - Check(PtrTy->isOpaqueOrPointeeTypeMatches(Call.getType()), - "masked_load: return must match pointer type", Call); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY Check(PassThru->getType() == Call.getType(), "masked_load: pass through and return type must match", Call); Check(cast(Mask->getType())->getElementCount() == @@ -5596,12 +5528,6 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) { Call); Check(Alignment->getValue().isPowerOf2(), "masked_store: alignment must be a power of 2", Call); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Value *Ptr = Call.getArgOperand(1); - PointerType *PtrTy = cast(Ptr->getType()); - Check(PtrTy->isOpaqueOrPointeeTypeMatches(Val->getType()), - "masked_store: storee must match pointer type", Call); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY Check(cast(Mask->getType())->getElementCount() == cast(Val->getType())->getElementCount(), "masked_store: vector mask must be same length as value", Call); @@ -5786,12 +5712,6 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) { NumRows = cast(Call.getArgOperand(3)); NumColumns = cast(Call.getArgOperand(4)); ResultTy = cast(Call.getType()); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - PointerType *Op0PtrTy = - cast(Call.getArgOperand(0)->getType()); - if (!Op0PtrTy->isOpaque()) - Op0ElemTy = Op0PtrTy->getNonOpaquePointerElementType(); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY break; } case Intrinsic::matrix_column_major_store: { @@ -5799,12 +5719,6 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) { NumRows = cast(Call.getArgOperand(4)); NumColumns = cast(Call.getArgOperand(5)); ResultTy = cast(Call.getArgOperand(0)->getType()); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - PointerType *Op1PtrTy = - cast(Call.getArgOperand(1)->getType()); - if (!Op1PtrTy->isOpaque()) - Op1ElemTy = Op1PtrTy->getNonOpaquePointerElementType(); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY Op0ElemTy = cast(Call.getArgOperand(0)->getType())->getElementType(); break; diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp index 80de5239d8222..572d169a44130 100644 --- a/llvm/lib/Linker/IRMover.cpp +++ b/llvm/lib/Linker/IRMover.cpp @@ -936,11 +936,7 @@ IRLinker::linkAppendingVarProto(GlobalVariable *DstGV, else IsOldStructor = true; } -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - PointerType *VoidPtrTy = Type::getInt8Ty(SrcGV->getContext())->getPointerTo(); -#else PointerType *VoidPtrTy = PointerType::get(SrcGV->getContext(), 0); -#endif if (IsOldStructor) { auto &ST = *cast(EltTy); Type *Tys[3] = {ST.getElementType(0), ST.getElementType(1), VoidPtrTy}; diff --git a/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp b/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp index 41506aa182329..17025867c1da3 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp @@ -1386,13 +1386,7 @@ bool AMDGPUPromoteAllocaImpl::tryPromoteAllocaToLDS(AllocaInst &I, CallInst *Call = dyn_cast(V); if (!Call) { if (ICmpInst *CI = dyn_cast(V)) { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY PointerType *NewTy = PointerType::get(Context, AMDGPUAS::LOCAL_ADDRESS); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - Value *Src0 = CI->getOperand(0); - PointerType *NewTy = PointerType::getWithSamePointeeType( - cast(Src0->getType()), AMDGPUAS::LOCAL_ADDRESS); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY if (isa(CI->getOperand(0))) CI->setOperand(0, ConstantPointerNull::get(NewTy)); @@ -1408,12 +1402,7 @@ bool AMDGPUPromoteAllocaImpl::tryPromoteAllocaToLDS(AllocaInst &I, if (isa(V)) continue; -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY PointerType *NewTy = PointerType::get(Context, AMDGPUAS::LOCAL_ADDRESS); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - PointerType *NewTy = PointerType::getWithSamePointeeType( - cast(V->getType()), AMDGPUAS::LOCAL_ADDRESS); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY // FIXME: It doesn't really make sense to try to do this for all // instructions. @@ -1473,12 +1462,7 @@ bool AMDGPUPromoteAllocaImpl::tryPromoteAllocaToLDS(AllocaInst &I, Function *ObjectSize = Intrinsic::getDeclaration( Mod, Intrinsic::objectsize, {Intr->getType(), -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY PointerType::get(Context, AMDGPUAS::LOCAL_ADDRESS)}); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - PointerType::getWithSamePointeeType( - cast(Src->getType()), AMDGPUAS::LOCAL_ADDRESS)}); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY CallInst *NewCall = Builder.CreateCall( ObjectSize, diff --git a/llvm/lib/Target/AMDGPU/AMDGPUPromoteKernelArguments.cpp b/llvm/lib/Target/AMDGPU/AMDGPUPromoteKernelArguments.cpp index 54aa7c5a9bdcf..9b654a2bba7f7 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUPromoteKernelArguments.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUPromoteKernelArguments.cpp @@ -115,13 +115,8 @@ bool AMDGPUPromoteKernelArguments::promotePointer(Value *Ptr) { // Cast pointer to global address space and back to flat and let // Infer Address Spaces pass to do all necessary rewriting. -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY PointerType *NewPT = PointerType::get(PT->getContext(), AMDGPUAS::GLOBAL_ADDRESS); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - PointerType *NewPT = - PointerType::getWithSamePointeeType(PT, AMDGPUAS::GLOBAL_ADDRESS); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY Value *Cast = B.CreateAddrSpaceCast(Ptr, NewPT, Twine(Ptr->getName(), ".global")); Value *CastBack = diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp index 8ae18b43361ca..805c39ecbd46d 100644 --- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp +++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp @@ -14621,15 +14621,8 @@ void SITargetLowering::emitExpandAtomicRMW(AtomicRMWInst *AI) const { Builder.CreateCondBr(IsShared, SharedBB, CheckPrivateBB); Builder.SetInsertPoint(SharedBB); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Value *CastToLocal = Builder.CreateAddrSpaceCast( Addr, PointerType::get(Ctx, AMDGPUAS::LOCAL_ADDRESS)); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - PointerType *PtrTy = cast(Addr->getType()); - Value *CastToLocal = Builder.CreateAddrSpaceCast( - Addr, - PointerType::getWithSamePointeeType(PtrTy, AMDGPUAS::LOCAL_ADDRESS)); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY Value *LoadedShared = CreateNewAtomicRMW(Builder, CastToLocal, Val); Builder.CreateBr(PhiBB); @@ -14639,14 +14632,8 @@ void SITargetLowering::emitExpandAtomicRMW(AtomicRMWInst *AI) const { Builder.CreateCondBr(IsPrivate, PrivateBB, GlobalBB); Builder.SetInsertPoint(PrivateBB); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Value *CastToPrivate = Builder.CreateAddrSpaceCast( Addr, PointerType::get(Ctx, AMDGPUAS::PRIVATE_ADDRESS)); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - Value *CastToPrivate = Builder.CreateAddrSpaceCast( - Addr, - PointerType::getWithSamePointeeType(PtrTy, AMDGPUAS::PRIVATE_ADDRESS)); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY Value *LoadedPrivate = Builder.CreateLoad(ValTy, CastToPrivate, "loaded.private"); Value *NewVal = Builder.CreateFAdd(LoadedPrivate, Val, "val.new"); @@ -14654,14 +14641,8 @@ void SITargetLowering::emitExpandAtomicRMW(AtomicRMWInst *AI) const { Builder.CreateBr(PhiBB); Builder.SetInsertPoint(GlobalBB); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Value *CastToGlobal = Builder.CreateAddrSpaceCast( Addr, PointerType::get(Ctx, AMDGPUAS::GLOBAL_ADDRESS)); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - Value *CastToGlobal = Builder.CreateAddrSpaceCast( - Addr, - PointerType::getWithSamePointeeType(PtrTy, AMDGPUAS::GLOBAL_ADDRESS)); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY Value *LoadedGlobal = CreateNewAtomicRMW(Builder, CastToGlobal, Val); Builder.CreateBr(PhiBB); diff --git a/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp b/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp index 5fe4d014a1bac..e2cc1bfd77a05 100644 --- a/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp +++ b/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp @@ -3847,13 +3847,6 @@ Value *HexagonTargetLowering::emitLoadLinked(IRBuilderBase &Builder, : Intrinsic::hexagon_L4_loadd_locked; Function *Fn = Intrinsic::getDeclaration(M, IntID); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - auto PtrTy = cast(Addr->getType()); - PointerType *NewPtrTy = - Builder.getIntNTy(SZ)->getPointerTo(PtrTy->getAddressSpace()); - Addr = Builder.CreateBitCast(Addr, NewPtrTy); - -#endif //INTEL_SYCL_OPAQUEPOINTER_READY Value *Call = Builder.CreateCall(Fn, Addr, "larx"); return Builder.CreateBitCast(Call, ValueTy); @@ -3875,10 +3868,6 @@ Value *HexagonTargetLowering::emitStoreConditional(IRBuilderBase &Builder, : Intrinsic::hexagon_S4_stored_locked; Function *Fn = Intrinsic::getDeclaration(M, IntID); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - unsigned AS = Addr->getType()->getPointerAddressSpace(); - Addr = Builder.CreateBitCast(Addr, CastTy->getPointerTo(AS)); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY Val = Builder.CreateBitCast(Val, CastTy); Value *Call = Builder.CreateCall(Fn, {Addr, Val}, "stcx"); diff --git a/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp b/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp index f83466f2e1eff..b2a55219df06a 100644 --- a/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp +++ b/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp @@ -684,41 +684,11 @@ auto AlignVectors::createAdjustedPointer(IRBuilderBase &Builder, Value *Ptr, Type *ValTy, int Adjust, const InstMap &CloneMap) const -> Value * { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY if (auto *I = dyn_cast(Ptr)) if (Instruction *New = CloneMap.lookup(I)) Ptr = New; return Builder.CreateGEP(Type::getInt8Ty(HVC.F.getContext()), Ptr, HVC.getConstInt(Adjust), "gep"); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - auto remap = [&](Value *V) -> Value * { - if (auto *I = dyn_cast(V)) { - for (auto [Old, New] : CloneMap) - I->replaceUsesOfWith(Old, New); - return I; - } - return V; - }; - // The adjustment is in bytes, but if it's a multiple of the type size, - // we don't need to do pointer casts. - auto *PtrTy = cast(Ptr->getType()); - if (!PtrTy->isOpaque()) { - Type *ElemTy = PtrTy->getNonOpaquePointerElementType(); - int ElemSize = HVC.getSizeOf(ElemTy, HVC.Alloc); - if (Adjust % ElemSize == 0 && Adjust != 0) { - Value *Tmp0 = Builder.CreateGEP( - ElemTy, Ptr, HVC.getConstInt(Adjust / ElemSize), "gep"); - return Builder.CreatePointerCast(remap(Tmp0), ValTy->getPointerTo(), - "cst"); - } - } - - PointerType *CharPtrTy = Type::getInt8PtrTy(HVC.F.getContext()); - Value *Tmp0 = Builder.CreatePointerCast(Ptr, CharPtrTy, "cst"); - Value *Tmp1 = Builder.CreateGEP(Type::getInt8Ty(HVC.F.getContext()), - remap(Tmp0), HVC.getConstInt(Adjust), "gep"); - return Builder.CreatePointerCast(remap(Tmp1), ValTy->getPointerTo(), "cst"); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY } auto AlignVectors::createAlignedPointer(IRBuilderBase &Builder, Value *Ptr, diff --git a/llvm/lib/Target/NVPTX/NVPTXLowerArgs.cpp b/llvm/lib/Target/NVPTX/NVPTXLowerArgs.cpp index 1db448bb057b1..5cd41cc39fd0f 100644 --- a/llvm/lib/Target/NVPTX/NVPTXLowerArgs.cpp +++ b/llvm/lib/Target/NVPTX/NVPTXLowerArgs.cpp @@ -190,12 +190,7 @@ static void convertToParamAS(Value *OldUser, Value *Param) { return NewGEP; } if (auto *BC = dyn_cast(I.OldInstruction)) { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY auto *NewBCType = PointerType::get(BC->getContext(), ADDRESS_SPACE_PARAM); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - auto *NewBCType = PointerType::getWithSamePointeeType( - cast(BC->getType()), ADDRESS_SPACE_PARAM); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY return BitCastInst::Create(BC->getOpcode(), I.NewParam, NewBCType, BC->getName(), BC); } @@ -411,13 +406,7 @@ void NVPTXLowerArgs::markPointerAsGlobal(Value *Ptr) { } Instruction *PtrInGlobal = new AddrSpaceCastInst( -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Ptr, PointerType::get(Ptr->getContext(), ADDRESS_SPACE_GLOBAL), -#else // INTEL_SYCL_OPAQUEPOINTER_READY - Ptr, - PointerType::getWithSamePointeeType(cast(Ptr->getType()), - ADDRESS_SPACE_GLOBAL), -#endif // INTEL_SYCL_OPAQUEPOINTER_READY Ptr->getName(), &*InsertPt); Value *PtrInGeneric = new AddrSpaceCastInst(PtrInGlobal, Ptr->getType(), Ptr->getName(), &*InsertPt); diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp index 216d10b1fe925..6a4995ea96b26 100644 --- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp @@ -17940,15 +17940,8 @@ static Value *useTpOffset(IRBuilderBase &IRB, unsigned Offset) { Module *M = IRB.GetInsertBlock()->getParent()->getParent(); Function *ThreadPointerFunc = Intrinsic::getDeclaration(M, Intrinsic::thread_pointer); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY return IRB.CreateConstGEP1_32(IRB.getInt8Ty(), IRB.CreateCall(ThreadPointerFunc), Offset); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - return IRB.CreatePointerCast( - IRB.CreateConstGEP1_32(IRB.getInt8Ty(), - IRB.CreateCall(ThreadPointerFunc), Offset), - IRB.getInt8PtrTy()->getPointerTo(0)); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY } Value *RISCVTargetLowering::getIRStackGuard(IRBuilderBase &IRB) const { diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 166bfab21fa24..6ac9391bcb58c 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -18628,19 +18628,10 @@ X86TargetLowering::LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const { // Get the Thread Pointer, which is %fs:__tls_array (32-bit) or // %gs:0x58 (64-bit). On MinGW, __tls_array is not available, so directly // use its literal value of 0x2C. -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Value *Ptr = Constant::getNullValue(Subtarget.is64Bit() - ? Type::getInt8PtrTy(*DAG.getContext(), - 256) - : Type::getInt32PtrTy(*DAG.getContext(), - 257)); -#else Value *Ptr = Constant::getNullValue( Subtarget.is64Bit() ? PointerType::get(*DAG.getContext(), 256) : PointerType::get(*DAG.getContext(), 257)); -#endif - SDValue TlsArray = Subtarget.is64Bit() ? DAG.getIntPtrConstant(0x58, dl) : (Subtarget.isTargetWindowsGNU() diff --git a/llvm/lib/Target/X86/X86ISelLoweringCall.cpp b/llvm/lib/Target/X86/X86ISelLoweringCall.cpp index ef374a1d3d80a..a9f84d1fb6122 100644 --- a/llvm/lib/Target/X86/X86ISelLoweringCall.cpp +++ b/llvm/lib/Target/X86/X86ISelLoweringCall.cpp @@ -561,11 +561,7 @@ static Constant* SegmentOffset(IRBuilderBase &IRB, int Offset, unsigned AddressSpace) { return ConstantExpr::getIntToPtr( ConstantInt::get(Type::getInt32Ty(IRB.getContext()), Offset), -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY IRB.getPtrTy(AddressSpace)); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - Type::getInt8PtrTy(IRB.getContext())->getPointerTo(AddressSpace)); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY } Value *X86TargetLowering::getIRStackGuard(IRBuilderBase &IRB) const { diff --git a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp index 8030333e83885..771e707dd65ab 100644 --- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp @@ -992,23 +992,8 @@ static StringRef solveTypeName(Type *Ty) { return "__floating_type_"; } -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY if (Ty->isPointerTy()) return "PointerType"; -#else // INTEL_SYCL_OPAQUEPOINTER_READY - if (auto *PtrTy = dyn_cast(Ty)) { - if (PtrTy->isOpaque()) - return "PointerType"; - Type *PointeeTy = PtrTy->getNonOpaquePointerElementType(); - auto Name = solveTypeName(PointeeTy); - if (Name == "UnknownType") - return "PointerType"; - SmallString<16> Buffer; - Twine(Name + "_Ptr").toStringRef(Buffer); - auto *MDName = MDString::get(Ty->getContext(), Buffer.str()); - return MDName->getString(); - } -#endif // INTEL_SYCL_OPAQUEPOINTER_READY if (Ty->isStructTy()) { if (!cast(Ty)->hasName()) @@ -2605,14 +2590,7 @@ static void eliminateSwiftErrorArgument(Function &F, Argument &Arg, IRBuilder<> Builder(F.getEntryBlock().getFirstNonPHIOrDbg()); auto ArgTy = cast(Arg.getType()); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY auto ValueTy = PointerType::getUnqual(F.getContext()); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - // swifterror arguments are required to have pointer-to-pointer type, - // so create a pointer-typed alloca with opaque pointers. - auto ValueTy = ArgTy->isOpaque() ? PointerType::getUnqual(F.getContext()) - : ArgTy->getNonOpaquePointerElementType(); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY // Reduce to the alloca case: diff --git a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp index 50609268ee98c..5569beb6e0273 100644 --- a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp @@ -816,9 +816,6 @@ Value *CoroCloner::deriveNewFramePointer() { auto *ActiveAsyncSuspend = cast(ActiveSuspend); auto ContextIdx = ActiveAsyncSuspend->getStorageArgumentIndex() & 0xff; auto *CalleeContext = NewF->getArg(ContextIdx); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - auto *FramePtrTy = Shape.FrameTy->getPointerTo(); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY auto *ProjectionFunc = ActiveAsyncSuspend->getAsyncContextProjectionFunction(); auto DbgLoc = @@ -838,11 +835,7 @@ Value *CoroCloner::deriveNewFramePointer() { auto InlineRes = InlineFunction(*CallerContext, InlineInfo); assert(InlineRes.isSuccess()); (void)InlineRes; -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY return FramePtrAddr; -#else // INTEL_SYCL_OPAQUEPOINTER_READY - return Builder.CreateBitCast(FramePtrAddr, FramePtrTy); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY } // In continuation-lowering, the argument is the opaque storage. case coro::ABI::Retcon: @@ -852,20 +845,10 @@ Value *CoroCloner::deriveNewFramePointer() { // If the storage is inline, just bitcast to the storage to the frame type. if (Shape.RetconLowering.IsFrameInlineInStorage) -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY return NewStorage; -#else // INTEL_SYCL_OPAQUEPOINTER_READY - return Builder.CreateBitCast(NewStorage, FramePtrTy); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY // Otherwise, load the real frame from the opaque storage. -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY return Builder.CreateLoad(FramePtrTy, NewStorage); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - auto FramePtrPtr = - Builder.CreateBitCast(NewStorage, FramePtrTy->getPointerTo()); - return Builder.CreateLoad(FramePtrTy, FramePtrPtr); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY } } llvm_unreachable("bad ABI"); @@ -1861,13 +1844,7 @@ static void splitRetconCoroutine(Function &F, coro::Shape &Shape, Builder.CreateBitCast(RawFramePtr, Shape.CoroBegin->getType()); // Stash the allocated frame pointer in the continuation storage. -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Builder.CreateStore(RawFramePtr, Id->getStorage()); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - auto Dest = Builder.CreateBitCast(Id->getStorage(), - RawFramePtr->getType()->getPointerTo()); - Builder.CreateStore(RawFramePtr, Dest); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY } // Map all uses of llvm.coro.begin to the allocated frame pointer. diff --git a/llvm/lib/Transforms/Coroutines/Coroutines.cpp b/llvm/lib/Transforms/Coroutines/Coroutines.cpp index ba40e7187090f..61cfbecfbe9be 100644 --- a/llvm/lib/Transforms/Coroutines/Coroutines.cpp +++ b/llvm/lib/Transforms/Coroutines/Coroutines.cpp @@ -37,11 +37,7 @@ using namespace llvm; // Construct the lowerer base class and initialize its members. coro::LowererBase::LowererBase(Module &M) : TheModule(M), Context(M.getContext()), -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Int8Ptr(PointerType::get(Context, 0)), -#else // INTEL_SYCL_OPAQUEPOINTER_READY - Int8Ptr(Type::getInt8PtrTy(Context, 0)), -#endif // INTEL_SYCL_OPAQUEPOINTER_READY ResumeFnType(FunctionType::get(Type::getVoidTy(Context), Int8Ptr, /*isVarArg=*/false)), NullPtr(ConstantPointerNull::get(Int8Ptr)) {} @@ -601,21 +597,6 @@ static void checkAsyncFuncPointer(const Instruction *I, Value *V) { auto *AsyncFuncPtrAddr = dyn_cast(V->stripPointerCasts()); if (!AsyncFuncPtrAddr) fail(I, "llvm.coro.id.async async function pointer not a global", V); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - if (AsyncFuncPtrAddr->getType()->isOpaquePointerTy()) - return; - - auto *StructTy = cast( - AsyncFuncPtrAddr->getType()->getNonOpaquePointerElementType()); - if (StructTy->isOpaque() || !StructTy->isPacked() || - StructTy->getNumElements() != 2 || - !StructTy->getElementType(0)->isIntegerTy(32) || - !StructTy->getElementType(1)->isIntegerTy(32)) - fail(I, - "llvm.coro.id.async async function pointer argument's type is not " - "<{i32, i32}>", - V); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY } void CoroIdAsyncInst::checkWellFormed() const { diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp index b4a1fff0df04c..d91b4f158c829 100644 --- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp +++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp @@ -12538,14 +12538,8 @@ struct AAAddressSpaceImpl : public AAAddressSpace { getAssociatedType()->getPointerAddressSpace()) return ChangeStatus::UNCHANGED; -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Type *NewPtrTy = PointerType::get(getAssociatedType()->getContext(), static_cast(getAddressSpace())); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - Type *NewPtrTy = PointerType::getWithSamePointeeType( - cast(getAssociatedType()), - static_cast(getAddressSpace())); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY bool UseOriginalValue = OriginalValue->getType()->getPointerAddressSpace() == static_cast(getAddressSpace()); diff --git a/llvm/lib/Transforms/IPO/CrossDSOCFI.cpp b/llvm/lib/Transforms/IPO/CrossDSOCFI.cpp index 29b5c03444dee..5cc8258a495a6 100644 --- a/llvm/lib/Transforms/IPO/CrossDSOCFI.cpp +++ b/llvm/lib/Transforms/IPO/CrossDSOCFI.cpp @@ -85,11 +85,7 @@ void CrossDSOCFI::buildCFICheck(Module &M) { LLVMContext &Ctx = M.getContext(); FunctionCallee C = M.getOrInsertFunction( "__cfi_check", Type::getVoidTy(Ctx), Type::getInt64Ty(Ctx), -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Type::getInt8PtrTy(Ctx), Type::getInt8PtrTy(Ctx)); -#else PointerType::getUnqual(Ctx), PointerType::getUnqual(Ctx)); -#endif Function *F = cast(C.getCallee()); // Take over the existing function. The frontend emits a weak stub so that the // linker knows about the symbol; this pass replaces the function body. @@ -114,15 +110,9 @@ void CrossDSOCFI::buildCFICheck(Module &M) { BasicBlock *TrapBB = BasicBlock::Create(Ctx, "fail", F); IRBuilder<> IRBFail(TrapBB); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - FunctionCallee CFICheckFailFn = - M.getOrInsertFunction("__cfi_check_fail", Type::getVoidTy(Ctx), - Type::getInt8PtrTy(Ctx), Type::getInt8PtrTy(Ctx)); -#else FunctionCallee CFICheckFailFn = M.getOrInsertFunction( "__cfi_check_fail", Type::getVoidTy(Ctx), PointerType::getUnqual(Ctx), PointerType::getUnqual(Ctx)); -#endif IRBFail.CreateCall(CFICheckFailFn, {&CFICheckFailData, &Addr}); IRBFail.CreateBr(ExitBB); diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp index 4d314a1a51e9b..3be19f46ee847 100644 --- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp +++ b/llvm/lib/Transforms/IPO/GlobalOpt.cpp @@ -1125,10 +1125,6 @@ optimizeOnceStoredGlobal(GlobalVariable *GV, Value *StoredOnceVal, nullptr /* F */, GV->getInitializer()->getType()->getPointerAddressSpace())) { if (Constant *SOVC = dyn_cast(StoredOnceVal)) { -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - if (GV->getInitializer()->getType() != SOVC->getType()) - SOVC = ConstantExpr::getBitCast(SOVC, GV->getInitializer()->getType()); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY // Optimize away any trapping uses of the loaded value. if (OptimizeAwayTrappingUsesOfLoads(GV, SOVC, DL, GetTLI)) return true; @@ -2096,11 +2092,7 @@ static void setUsedInitializer(GlobalVariable &V, // Type of pointer to the array of pointers. PointerType *PtrTy = -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY PointerType::get(V.getContext(), VEPT->getAddressSpace()); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - Type::getInt8PtrTy(V.getContext(), VEPT->getAddressSpace()); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY SmallVector UsedArray; for (GlobalValue *GV : Init) { diff --git a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp index 9e82c211fb5f5..2ffdb1e31087d 100644 --- a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp +++ b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp @@ -420,18 +420,10 @@ class LowerTypeTestsModule { IntegerType *Int1Ty = Type::getInt1Ty(M.getContext()); IntegerType *Int8Ty = Type::getInt8Ty(M.getContext()); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - PointerType *Int8PtrTy = Type::getInt8PtrTy(M.getContext()); -#else PointerType *Int8PtrTy = PointerType::getUnqual(M.getContext()); -#endif ArrayType *Int8Arr0Ty = ArrayType::get(Type::getInt8Ty(M.getContext()), 0); IntegerType *Int32Ty = Type::getInt32Ty(M.getContext()); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - PointerType *Int32PtrTy = PointerType::getUnqual(Int32Ty); -#else PointerType *Int32PtrTy = PointerType::getUnqual(M.getContext()); -#endif IntegerType *Int64Ty = Type::getInt64Ty(M.getContext()); IntegerType *IntPtrTy = M.getDataLayout().getIntPtrType(M.getContext(), 0); diff --git a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp index c6e680c1a1649..63493eb78c451 100644 --- a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp +++ b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp @@ -4390,11 +4390,7 @@ struct AAKernelInfoFunction : AAKernelInfo { // Create local storage for the work function pointer. const DataLayout &DL = M.getDataLayout(); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Type *VoidPtrTy = Type::getInt8PtrTy(Ctx); -#else Type *VoidPtrTy = PointerType::getUnqual(Ctx); -#endif Instruction *WorkFnAI = new AllocaInst(VoidPtrTy, DL.getAllocaAddrSpace(), nullptr, "worker.work_fn.addr", &Kernel->getEntryBlock().front()); @@ -4420,14 +4416,7 @@ struct AAKernelInfoFunction : AAKernelInfo { if (WorkFnAI->getType()->getPointerAddressSpace() != (unsigned int)AddressSpace::Generic) { WorkFnAI = new AddrSpaceCastInst( -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY WorkFnAI, PointerType::get(Ctx, (unsigned int)AddressSpace::Generic), -#else // INTEL_SYCL_OPAQUEPOINTER_READY - WorkFnAI, - PointerType::getWithSamePointeeType( - cast(WorkFnAI->getType()), - (unsigned int)AddressSpace::Generic), -#endif // INTEL_SYCL_OPAQUEPOINTER_READY WorkFnAI->getName() + ".generic", StateMachineBeginBB); WorkFnAI->setDebugLoc(DLoc); } diff --git a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp index dc9b5475f2fb6..227e1e0e74f8a 100644 --- a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp +++ b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp @@ -590,11 +590,7 @@ struct DevirtModule { : M(M), AARGetter(AARGetter), LookupDomTree(LookupDomTree), ExportSummary(ExportSummary), ImportSummary(ImportSummary), Int8Ty(Type::getInt8Ty(M.getContext())), -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Int8PtrTy(Type::getInt8PtrTy(M.getContext())), -#else Int8PtrTy(PointerType::getUnqual(M.getContext())), -#endif Int32Ty(Type::getInt32Ty(M.getContext())), Int64Ty(Type::getInt64Ty(M.getContext())), IntPtrTy(M.getDataLayout().getIntPtrType(M.getContext(), 0)), @@ -1441,11 +1437,7 @@ void DevirtModule::applyICallBranchFunnel(VTableSlotInfo &SlotInfo, IRBuilder<> IRB(&CB); std::vector Args; -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Args.push_back(VCallSite.VTable); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - Args.push_back(IRB.CreateBitCast(VCallSite.VTable, Int8PtrTy)); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY llvm::append_range(Args, CB.args()); CallBase *NewCS = nullptr; @@ -1716,12 +1708,7 @@ void DevirtModule::applyVirtualConstProp(CallSiteInfo &CSInfo, StringRef FnName, continue; auto *RetType = cast(Call.CB.getType()); IRBuilder<> B(&Call.CB); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Value *Addr = B.CreateGEP(Int8Ty, Call.VTable, Byte); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - Value *Addr = - B.CreateGEP(Int8Ty, B.CreateBitCast(Call.VTable, Int8PtrTy), Byte); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY if (RetType->getBitWidth() == 1) { Value *Bits = B.CreateLoad(Int8Ty, Addr); Value *BitsAndBit = B.CreateAnd(Bits, Bit); @@ -2019,25 +2006,14 @@ void DevirtModule::scanTypeCheckedLoadUsers(Function *TypeCheckedLoadFunc) { if (TypeCheckedLoadFunc->getIntrinsicID() == Intrinsic::type_checked_load_relative) { Value *GEP = LoadB.CreateGEP(Int8Ty, Ptr, Offset); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY LoadedValue = LoadB.CreateLoad(Int32Ty, GEP); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - Value *GEPPtr = LoadB.CreateBitCast(GEP, PointerType::getUnqual(Int32Ty)); - LoadedValue = LoadB.CreateLoad(Int32Ty, GEPPtr); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY LoadedValue = LoadB.CreateSExt(LoadedValue, IntPtrTy); GEP = LoadB.CreatePtrToInt(GEP, IntPtrTy); LoadedValue = LoadB.CreateAdd(GEP, LoadedValue); LoadedValue = LoadB.CreateIntToPtr(LoadedValue, Int8PtrTy); } else { Value *GEP = LoadB.CreateGEP(Int8Ty, Ptr, Offset); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY LoadedValue = LoadB.CreateLoad(Int8PtrTy, GEP); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - Value *GEPPtr = - LoadB.CreateBitCast(GEP, PointerType::getUnqual(Int8PtrTy)); - LoadedValue = LoadB.CreateLoad(Int8PtrTy, GEPPtr); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY } for (Instruction *LoadedPtr : LoadedPtrs) { diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp index b38cf9996e4e6..85c177da30007 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -174,17 +174,7 @@ Instruction *InstCombinerImpl::SimplifyAnyMemTransfer(AnyMemTransferInst *MI) { return nullptr; // Use an integer load+store unless we can find something better. -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - unsigned SrcAddrSp = - cast(MI->getArgOperand(1)->getType())->getAddressSpace(); - unsigned DstAddrSp = - cast(MI->getArgOperand(0)->getType())->getAddressSpace(); -#endif - IntegerType* IntType = IntegerType::get(MI->getContext(), Size<<3); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Type *NewSrcPtrTy = PointerType::get(IntType, SrcAddrSp); - Type *NewDstPtrTy = PointerType::get(IntType, DstAddrSp); -#endif + IntegerType *IntType = IntegerType::get(MI->getContext(), Size << 3); // If the memcpy has metadata describing the members, see if we can get the // TBAA tag describing our copy. @@ -203,13 +193,8 @@ Instruction *InstCombinerImpl::SimplifyAnyMemTransfer(AnyMemTransferInst *MI) { CopyMD = cast(M->getOperand(2)); } -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Value *Src = Builder.CreateBitCast(MI->getArgOperand(1), NewSrcPtrTy); - Value *Dest = Builder.CreateBitCast(MI->getArgOperand(0), NewDstPtrTy); -#else Value *Src = MI->getArgOperand(1); Value *Dest = MI->getArgOperand(0); -#endif LoadInst *L = Builder.CreateLoad(IntType, Src); // Alignment from the mem intrinsic will be better, so use it. L->setAlignment(*CopySrcAlign); @@ -299,11 +284,6 @@ Instruction *InstCombinerImpl::SimplifyAnyMemSet(AnyMemSetInst *MI) { Type *ITy = IntegerType::get(MI->getContext(), Len*8); // n=1 -> i8. Value *Dest = MI->getDest(); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - unsigned DstAddrSp = cast(Dest->getType())->getAddressSpace(); - Type *NewDstPtrTy = PointerType::get(ITy, DstAddrSp); - Dest = Builder.CreateBitCast(Dest, NewDstPtrTy); -#endif // Extract the fill value and store. const uint64_t Fill = FillC->getZExtValue()*0x0101010101010101ULL; @@ -510,10 +490,6 @@ static Instruction *simplifyInvariantGroupIntrinsic(IntrinsicInst &II, if (Result->getType()->getPointerAddressSpace() != II.getType()->getPointerAddressSpace()) Result = IC.Builder.CreateAddrSpaceCast(Result, II.getType()); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - if (Result->getType() != II.getType()) - Result = IC.Builder.CreateBitCast(Result, II.getType()); -#endif return cast(Result); } @@ -3873,26 +3849,6 @@ bool InstCombinerImpl::transformConstExprCastCall(CallBase &Call) { if (CallerPAL.hasParamAttr(i, Attribute::ByVal) != Callee->getAttributes().hasParamAttr(i, Attribute::ByVal)) return false; // Cannot transform to or from byval. - -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - // If the parameter is passed as a byval argument, then we have to have a - // sized type and the sized type has to have the same size as the old type. - if (ParamTy != ActTy && CallerPAL.hasParamAttr(i, Attribute::ByVal)) { - PointerType *ParamPTy = dyn_cast(ParamTy); - if (!ParamPTy) - return false; - - if (!ParamPTy->isOpaque()) { - Type *ParamElTy = ParamPTy->getNonOpaquePointerElementType(); - if (!ParamElTy->isSized()) - return false; - - Type *CurElTy = Call.getParamByValType(i); - if (DL.getTypeAllocSize(CurElTy) != DL.getTypeAllocSize(ParamElTy)) - return false; - } - } -#endif // INTEL_SYCL_OPAQUEPOINTER_READY } if (Callee->isDeclaration()) { @@ -3953,21 +3909,8 @@ bool InstCombinerImpl::transformConstExprCastCall(CallBase &Call) { // type. Note that we made sure all incompatible ones are safe to drop. AttributeMask IncompatibleAttrs = AttributeFuncs::typeIncompatible( ParamTy, AttributeFuncs::ASK_SAFE_TO_DROP); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY ArgAttrs.push_back( CallerPAL.getParamAttrs(i).removeAttributes(Ctx, IncompatibleAttrs)); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - if (CallerPAL.hasParamAttr(i, Attribute::ByVal) && - !ParamTy->isOpaquePointerTy()) { - AttrBuilder AB(Ctx, CallerPAL.getParamAttrs(i).removeAttributes( - Ctx, IncompatibleAttrs)); - AB.addByValAttr(ParamTy->getNonOpaquePointerElementType()); - ArgAttrs.push_back(AttributeSet::get(Ctx, AB)); - } else { - ArgAttrs.push_back( - CallerPAL.getParamAttrs(i).removeAttributes(Ctx, IncompatibleAttrs)); - } -#endif // INTEL_SYCL_OPAQUEPOINTER_READY } // If the function takes more arguments than the call was taking, add them diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp index 2cd53a3adad27..42cc7d52fae3b 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp @@ -25,168 +25,6 @@ using namespace PatternMatch; #define DEBUG_TYPE "instcombine" -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY -/// Analyze 'Val', seeing if it is a simple linear expression. -/// If so, decompose it, returning some value X, such that Val is -/// X*Scale+Offset. -/// -static Value *decomposeSimpleLinearExpr(Value *Val, unsigned &Scale, - uint64_t &Offset) { - if (ConstantInt *CI = dyn_cast(Val)) { - Offset = CI->getZExtValue(); - Scale = 0; - return ConstantInt::get(Val->getType(), 0); - } - - if (BinaryOperator *I = dyn_cast(Val)) { - // Cannot look past anything that might overflow. - // We specifically require nuw because we store the Scale in an unsigned - // and perform an unsigned divide on it. - OverflowingBinaryOperator *OBI = dyn_cast(Val); - if (OBI && !OBI->hasNoUnsignedWrap()) { - Scale = 1; - Offset = 0; - return Val; - } - - if (ConstantInt *RHS = dyn_cast(I->getOperand(1))) { - if (I->getOpcode() == Instruction::Shl) { - // This is a value scaled by '1 << the shift amt'. - Scale = UINT64_C(1) << RHS->getZExtValue(); - Offset = 0; - return I->getOperand(0); - } - - if (I->getOpcode() == Instruction::Mul) { - // This value is scaled by 'RHS'. - Scale = RHS->getZExtValue(); - Offset = 0; - return I->getOperand(0); - } - - if (I->getOpcode() == Instruction::Add) { - // We have X+C. Check to see if we really have (X*C2)+C1, - // where C1 is divisible by C2. - unsigned SubScale; - Value *SubVal = - decomposeSimpleLinearExpr(I->getOperand(0), SubScale, Offset); - Offset += RHS->getZExtValue(); - Scale = SubScale; - return SubVal; - } - } - } - - // Otherwise, we can't look past this. - Scale = 1; - Offset = 0; - return Val; -} - -/// If we find a cast of an allocation instruction, try to eliminate the cast by -/// moving the type information into the alloc. -Instruction *InstCombinerImpl::PromoteCastOfAllocation(BitCastInst &CI, - AllocaInst &AI) { - PointerType *PTy = cast(CI.getType()); - // Opaque pointers don't have an element type we could replace with. - if (PTy->isOpaque()) - return nullptr; - - IRBuilderBase::InsertPointGuard Guard(Builder); - Builder.SetInsertPoint(&AI); - - // Get the type really allocated and the type casted to. - Type *AllocElTy = AI.getAllocatedType(); - Type *CastElTy = PTy->getNonOpaquePointerElementType(); - if (!AllocElTy->isSized() || !CastElTy->isSized()) return nullptr; - - // This optimisation does not work for cases where the cast type - // is scalable and the allocated type is not. This because we need to - // know how many times the casted type fits into the allocated type. - // For the opposite case where the allocated type is scalable and the - // cast type is not this leads to poor code quality due to the - // introduction of 'vscale' into the calculations. It seems better to - // bail out for this case too until we've done a proper cost-benefit - // analysis. - bool AllocIsScalable = isa(AllocElTy); - bool CastIsScalable = isa(CastElTy); - if (AllocIsScalable != CastIsScalable) return nullptr; - - Align AllocElTyAlign = DL.getABITypeAlign(AllocElTy); - Align CastElTyAlign = DL.getABITypeAlign(CastElTy); - if (CastElTyAlign < AllocElTyAlign) return nullptr; - - // If the allocation has multiple uses, only promote it if we are strictly - // increasing the alignment of the resultant allocation. If we keep it the - // same, we open the door to infinite loops of various kinds. - if (!AI.hasOneUse() && CastElTyAlign == AllocElTyAlign) return nullptr; - - // The alloc and cast types should be either both fixed or both scalable. - uint64_t AllocElTySize = DL.getTypeAllocSize(AllocElTy).getKnownMinValue(); - uint64_t CastElTySize = DL.getTypeAllocSize(CastElTy).getKnownMinValue(); - if (CastElTySize == 0 || AllocElTySize == 0) return nullptr; - - // If the allocation has multiple uses, only promote it if we're not - // shrinking the amount of memory being allocated. - uint64_t AllocElTyStoreSize = - DL.getTypeStoreSize(AllocElTy).getKnownMinValue(); - uint64_t CastElTyStoreSize = DL.getTypeStoreSize(CastElTy).getKnownMinValue(); - if (!AI.hasOneUse() && CastElTyStoreSize < AllocElTyStoreSize) return nullptr; - - // See if we can satisfy the modulus by pulling a scale out of the array - // size argument. - unsigned ArraySizeScale; - uint64_t ArrayOffset; - Value *NumElements = // See if the array size is a decomposable linear expr. - decomposeSimpleLinearExpr(AI.getOperand(0), ArraySizeScale, ArrayOffset); - - // If we can now satisfy the modulus, by using a non-1 scale, we really can - // do the xform. - if ((AllocElTySize*ArraySizeScale) % CastElTySize != 0 || - (AllocElTySize*ArrayOffset ) % CastElTySize != 0) return nullptr; - - // We don't currently support arrays of scalable types. - assert(!AllocIsScalable || (ArrayOffset == 1 && ArraySizeScale == 0)); - - unsigned Scale = (AllocElTySize*ArraySizeScale)/CastElTySize; - Value *Amt = nullptr; - if (Scale == 1) { - Amt = NumElements; - } else { - Amt = ConstantInt::get(AI.getArraySize()->getType(), Scale); - // Insert before the alloca, not before the cast. - Amt = Builder.CreateMul(Amt, NumElements); - } - - if (uint64_t Offset = (AllocElTySize*ArrayOffset)/CastElTySize) { - Value *Off = ConstantInt::get(AI.getArraySize()->getType(), - Offset, true); - Amt = Builder.CreateAdd(Amt, Off); - } - - AllocaInst *New = Builder.CreateAlloca(CastElTy, AI.getAddressSpace(), Amt); - New->setAlignment(AI.getAlign()); - New->takeName(&AI); - New->setUsedWithInAlloca(AI.isUsedWithInAlloca()); - New->setMetadata(LLVMContext::MD_DIAssignID, - AI.getMetadata(LLVMContext::MD_DIAssignID)); - - replaceAllDbgUsesWith(AI, *New, *New, DT); - - // If the allocation has multiple real uses, insert a cast and change all - // things that used it to use the new cast. This will also hack on CI, but it - // will die soon. - if (!AI.hasOneUse()) { - // New is the allocation instruction, pointer typed. AI is the original - // allocation instruction, also pointer typed. Thus, cast to use is BitCast. - Value *NewCast = Builder.CreateBitCast(New, AI.getType(), "tmpcast"); - replaceInstUsesWith(AI, NewCast); - eraseInstFromFunction(AI); - } - return replaceInstUsesWith(CI, New); -} -#endif // INTEL_SYCL_OPAQUEPOINTER_READY - /// Given an expression that CanEvaluateTruncated or CanEvaluateSExtd returns /// true for, actually insert the code to evaluate the expression. Value *InstCombinerImpl::EvaluateInDifferentType(Value *V, Type *Ty, @@ -2729,59 +2567,6 @@ Instruction *InstCombinerImpl::optimizeBitCastFromPhi(CastInst &CI, return RetVal; } -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY -static Instruction *convertBitCastToGEP(BitCastInst &CI, IRBuilderBase &Builder, - const DataLayout &DL) { - Value *Src = CI.getOperand(0); - PointerType *SrcPTy = cast(Src->getType()); - PointerType *DstPTy = cast(CI.getType()); - - // Bitcasts involving opaque pointers cannot be converted into a GEP. - if (SrcPTy->isOpaque() || DstPTy->isOpaque()) - return nullptr; - - Type *DstElTy = DstPTy->getNonOpaquePointerElementType(); - Type *SrcElTy = SrcPTy->getNonOpaquePointerElementType(); - - // When the type pointed to is not sized the cast cannot be - // turned into a gep. - if (!SrcElTy->isSized()) - return nullptr; - - // If the source and destination are pointers, and this cast is equivalent - // to a getelementptr X, 0, 0, 0... turn it into the appropriate gep. - // This can enhance SROA and other transforms that want type-safe pointers. - unsigned NumZeros = 0; - while (SrcElTy && SrcElTy != DstElTy) { - SrcElTy = GetElementPtrInst::getTypeAtIndex(SrcElTy, (uint64_t)0); - ++NumZeros; - } - - // If we found a path from the src to dest, create the getelementptr now. - if (SrcElTy == DstElTy) { - SmallVector Idxs(NumZeros + 1, Builder.getInt32(0)); - GetElementPtrInst *GEP = GetElementPtrInst::Create( - SrcPTy->getNonOpaquePointerElementType(), Src, Idxs); - - // If the source pointer is dereferenceable, then assume it points to an - // allocated object and apply "inbounds" to the GEP. - bool CanBeNull, CanBeFreed; - if (Src->getPointerDereferenceableBytes(DL, CanBeNull, CanBeFreed)) { - // In a non-default address space (not 0), a null pointer can not be - // assumed inbounds, so ignore that case (dereferenceable_or_null). - // The reason is that 'null' is not treated differently in these address - // spaces, and we consequently ignore the 'gep inbounds' special case - // for 'null' which allows 'inbounds' on 'null' if the indices are - // zeros. - if (SrcPTy->getAddressSpace() == 0 || !CanBeNull) - GEP->setIsInBounds(); - } - return GEP; - } - return nullptr; -} -#endif // INTEL_SYCL_OPAQUEPOINTER_READY - Instruction *InstCombinerImpl::visitBitCast(BitCastInst &CI) { // If the operands are integer typed then apply the integer transforms, // otherwise just apply the common ones. @@ -2794,21 +2579,6 @@ Instruction *InstCombinerImpl::visitBitCast(BitCastInst &CI) { if (DestTy == Src->getType()) return replaceInstUsesWith(CI, Src); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - if (isa(SrcTy) && isa(DestTy)) { - // If we are casting a alloca to a pointer to a type of the same - // size, rewrite the allocation instruction to allocate the "right" type. - // There is no need to modify malloc calls because it is their bitcast that - // needs to be cleaned up. - if (AllocaInst *AI = dyn_cast(Src)) - if (Instruction *V = PromoteCastOfAllocation(CI, *AI)) - return V; - - if (Instruction *I = convertBitCastToGEP(CI, Builder, DL)) - return I; - } -#endif // INTEL_SYCL_OPAQUEPOINTER_READY - if (FixedVectorType *DestVTy = dyn_cast(DestTy)) { // Beware: messing with this target-specific oddity may cause trouble. if (DestVTy->getNumElements() == 1 && SrcTy->isX86_MMXTy()) { diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index 5d365bc30df53..c9963055d91bc 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -623,13 +623,8 @@ static Value *rewriteGEPAsOffset(Type *ElemTy, Value *Start, Value *Base, } } } -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - PointerType *PtrTy = - ElemTy->getPointerTo(Start->getType()->getPointerAddressSpace()); -#else PointerType *PtrTy = PointerType::get( Base->getContext(), Start->getType()->getPointerAddressSpace()); -#endif for (Value *Val : Explored) { if (Val == Base) continue; diff --git a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h index 57b975419f3b1..7e9b916783a0e 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h +++ b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h @@ -155,9 +155,6 @@ class LLVM_LIBRARY_VISIBILITY InstCombinerImpl final Instruction *visitPHINode(PHINode &PN); Instruction *visitGetElementPtrInst(GetElementPtrInst &GEP); Instruction *visitGEPOfGEP(GetElementPtrInst &GEP, GEPOperator *Src); - #ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Instruction *visitGEPOfBitcast(BitCastInst *BCI, GetElementPtrInst &GEP); - #endif // INTEL_SYCL_OPAQUEPOINTER_READY Instruction *visitAllocaInst(AllocaInst &AI); Instruction *visitAllocSite(Instruction &FI); Instruction *visitFree(CallInst &FI, Value *FreedOp); @@ -403,11 +400,7 @@ class LLVM_LIBRARY_VISIBILITY InstCombinerImpl final void CreateNonTerminatorUnreachable(Instruction *InsertAt) { auto &Ctx = InsertAt->getContext(); auto *SI = new StoreInst(ConstantInt::getTrue(Ctx), -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - PoisonValue::get(Type::getInt1PtrTy(Ctx)), -#else PoisonValue::get(PointerType::getUnqual(Ctx)), -#endif /*isVolatile*/ false, Align(1)); InsertNewInstBefore(SI, *InsertAt); } @@ -667,9 +660,6 @@ class LLVM_LIBRARY_VISIBILITY InstCombinerImpl final Value *insertRangeTest(Value *V, const APInt &Lo, const APInt &Hi, bool isSigned, bool Inside); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Instruction *PromoteCastOfAllocation(BitCastInst &CI, AllocaInst &AI); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY bool mergeStoreIntoSuccessor(StoreInst &SI); /// Given an initial instruction, check to see if it is the root of a @@ -683,13 +673,6 @@ class LLVM_LIBRARY_VISIBILITY InstCombinerImpl final Value *EvaluateInDifferentType(Value *V, Type *Ty, bool isSigned); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - /// Returns a value X such that Val = X * Scale, or null if none. - /// - /// If the multiplication is known not to overflow then NoSignedWrap is set. - Value *Descale(Value *Val, APInt Scale, bool &NoSignedWrap); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY - bool tryToSinkInstruction(Instruction *I, BasicBlock *DestBlock); bool removeInstructionsBeforeUnreachable(Instruction &I); diff --git a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp index 29d12e269f630..7fedd213e4169 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp @@ -404,14 +404,8 @@ void PointerReplacer::replace(Instruction *I) { } else if (auto *BC = dyn_cast(I)) { auto *V = getReplacement(BC->getOperand(0)); assert(V && "Operand not replaced"); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY auto *NewT = PointerType::get(BC->getType()->getContext(), V->getType()->getPointerAddressSpace()); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - auto *NewT = PointerType::getWithSamePointeeType( - cast(BC->getType()), - V->getType()->getPointerAddressSpace()); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY auto *NewI = new BitCastInst(V, NewT); IC.InsertNewInstWith(NewI, *BC); NewI->takeName(BC); @@ -583,22 +577,9 @@ LoadInst *InstCombinerImpl::combineLoadToNewType(LoadInst &LI, Type *NewTy, assert((!LI.isAtomic() || isSupportedAtomicType(NewTy)) && "can't fold an atomic load to requested type"); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY LoadInst *NewLoad = Builder.CreateAlignedLoad(NewTy, LI.getPointerOperand(), LI.getAlign(), LI.isVolatile(), LI.getName() + Suffix); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - Value *Ptr = LI.getPointerOperand(); - unsigned AS = LI.getPointerAddressSpace(); - Type *NewPtrTy = NewTy->getPointerTo(AS); - Value *NewPtr = nullptr; - if (!(match(Ptr, m_BitCast(m_Value(NewPtr))) && - NewPtr->getType() == NewPtrTy)) - NewPtr = Builder.CreateBitCast(Ptr, NewPtrTy); - - LoadInst *NewLoad = Builder.CreateAlignedLoad( - NewTy, NewPtr, LI.getAlign(), LI.isVolatile(), LI.getName() + Suffix); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY NewLoad->setAtomic(LI.getOrdering(), LI.getSyncScopeID()); copyMetadataForLoad(*NewLoad, LI); @@ -614,20 +595,11 @@ static StoreInst *combineStoreToNewValue(InstCombinerImpl &IC, StoreInst &SI, "can't fold an atomic store of requested type"); Value *Ptr = SI.getPointerOperand(); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - unsigned AS = SI.getPointerAddressSpace(); -#endif SmallVector, 8> MD; SI.getAllMetadata(MD); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY StoreInst *NewStore = IC.Builder.CreateAlignedStore(V, Ptr, SI.getAlign(), SI.isVolatile()); -#else - StoreInst *NewStore = IC.Builder.CreateAlignedStore( - V, IC.Builder.CreateBitCast(Ptr, V->getType()->getPointerTo(AS)), - SI.getAlign(), SI.isVolatile()); -#endif NewStore->setAtomic(SI.getOrdering(), SI.getSyncScopeID()); for (const auto &MDPair : MD) { unsigned ID = MDPair.first; diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp index af960ea01c294..be857cd1fac91 100644 --- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -1630,30 +1630,6 @@ Instruction *InstCombinerImpl::foldBinOpIntoSelectOrPhi(BinaryOperator &I) { return nullptr; } -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY -/// Given a pointer type and a constant offset, determine whether or not there -/// is a sequence of GEP indices into the pointed type that will land us at the -/// specified offset. If so, fill them into NewIndices and return the resultant -/// element type, otherwise return null. -static Type *findElementAtOffset(PointerType *PtrTy, int64_t IntOffset, - SmallVectorImpl &NewIndices, - const DataLayout &DL) { - // Only used by visitGEPOfBitcast(), which is skipped for opaque pointers. - Type *Ty = PtrTy->getNonOpaquePointerElementType(); - if (!Ty->isSized()) - return nullptr; - - APInt Offset(DL.getIndexTypeSizeInBits(PtrTy), IntOffset); - SmallVector Indices = DL.getGEPIndicesForOffset(Ty, Offset); - if (!Offset.isZero()) - return nullptr; - - for (const APInt &Index : Indices) - NewIndices.push_back(ConstantInt::get(PtrTy->getContext(), Index)); - return Ty; -} -#endif // INTEL_SYCL_OPAQUEPOINTER_READY - static bool shouldMergeGEPs(GEPOperator &GEP, GEPOperator &Src) { // If this GEP has only 0 indices, it is the same pointer as // Src. If Src is not a trivial GEP too, don't combine @@ -1664,250 +1640,6 @@ static bool shouldMergeGEPs(GEPOperator &GEP, GEPOperator &Src) { return true; } -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY -/// Return a value X such that Val = X * Scale, or null if none. -/// If the multiplication is known not to overflow, then NoSignedWrap is set. -Value *InstCombinerImpl::Descale(Value *Val, APInt Scale, bool &NoSignedWrap) { - assert(isa(Val->getType()) && "Can only descale integers!"); - assert(cast(Val->getType())->getBitWidth() == - Scale.getBitWidth() && "Scale not compatible with value!"); - - // If Val is zero or Scale is one then Val = Val * Scale. - if (match(Val, m_Zero()) || Scale == 1) { - NoSignedWrap = true; - return Val; - } - - // If Scale is zero then it does not divide Val. - if (Scale.isMinValue()) - return nullptr; - - // Look through chains of multiplications, searching for a constant that is - // divisible by Scale. For example, descaling X*(Y*(Z*4)) by a factor of 4 - // will find the constant factor 4 and produce X*(Y*Z). Descaling X*(Y*8) by - // a factor of 4 will produce X*(Y*2). The principle of operation is to bore - // down from Val: - // - // Val = M1 * X || Analysis starts here and works down - // M1 = M2 * Y || Doesn't descend into terms with more - // M2 = Z * 4 \/ than one use - // - // Then to modify a term at the bottom: - // - // Val = M1 * X - // M1 = Z * Y || Replaced M2 with Z - // - // Then to work back up correcting nsw flags. - - // Op - the term we are currently analyzing. Starts at Val then drills down. - // Replaced with its descaled value before exiting from the drill down loop. - Value *Op = Val; - - // Parent - initially null, but after drilling down notes where Op came from. - // In the example above, Parent is (Val, 0) when Op is M1, because M1 is the - // 0'th operand of Val. - std::pair Parent; - - // Set if the transform requires a descaling at deeper levels that doesn't - // overflow. - bool RequireNoSignedWrap = false; - - // Log base 2 of the scale. Negative if not a power of 2. - int32_t logScale = Scale.exactLogBase2(); - - for (;; Op = Parent.first->getOperand(Parent.second)) { // Drill down - if (ConstantInt *CI = dyn_cast(Op)) { - // If Op is a constant divisible by Scale then descale to the quotient. - APInt Quotient(Scale), Remainder(Scale); // Init ensures right bitwidth. - APInt::sdivrem(CI->getValue(), Scale, Quotient, Remainder); - if (!Remainder.isMinValue()) - // Not divisible by Scale. - return nullptr; - // Replace with the quotient in the parent. - Op = ConstantInt::get(CI->getType(), Quotient); - NoSignedWrap = true; - break; - } - - if (BinaryOperator *BO = dyn_cast(Op)) { - if (BO->getOpcode() == Instruction::Mul) { - // Multiplication. - NoSignedWrap = BO->hasNoSignedWrap(); - if (RequireNoSignedWrap && !NoSignedWrap) - return nullptr; - - // There are three cases for multiplication: multiplication by exactly - // the scale, multiplication by a constant different to the scale, and - // multiplication by something else. - Value *LHS = BO->getOperand(0); - Value *RHS = BO->getOperand(1); - - if (ConstantInt *CI = dyn_cast(RHS)) { - // Multiplication by a constant. - if (CI->getValue() == Scale) { - // Multiplication by exactly the scale, replace the multiplication - // by its left-hand side in the parent. - Op = LHS; - break; - } - - // Otherwise drill down into the constant. - if (!Op->hasOneUse()) - return nullptr; - - Parent = std::make_pair(BO, 1); - continue; - } - - // Multiplication by something else. Drill down into the left-hand side - // since that's where the reassociate pass puts the good stuff. - if (!Op->hasOneUse()) - return nullptr; - - Parent = std::make_pair(BO, 0); - continue; - } - - if (logScale > 0 && BO->getOpcode() == Instruction::Shl && - isa(BO->getOperand(1))) { - // Multiplication by a power of 2. - NoSignedWrap = BO->hasNoSignedWrap(); - if (RequireNoSignedWrap && !NoSignedWrap) - return nullptr; - - Value *LHS = BO->getOperand(0); - int32_t Amt = cast(BO->getOperand(1))-> - getLimitedValue(Scale.getBitWidth()); - // Op = LHS << Amt. - - if (Amt == logScale) { - // Multiplication by exactly the scale, replace the multiplication - // by its left-hand side in the parent. - Op = LHS; - break; - } - if (Amt < logScale || !Op->hasOneUse()) - return nullptr; - - // Multiplication by more than the scale. Reduce the multiplying amount - // by the scale in the parent. - Parent = std::make_pair(BO, 1); - Op = ConstantInt::get(BO->getType(), Amt - logScale); - break; - } - } - - if (!Op->hasOneUse()) - return nullptr; - - if (CastInst *Cast = dyn_cast(Op)) { - if (Cast->getOpcode() == Instruction::SExt) { - // Op is sign-extended from a smaller type, descale in the smaller type. - unsigned SmallSize = Cast->getSrcTy()->getPrimitiveSizeInBits(); - APInt SmallScale = Scale.trunc(SmallSize); - // Suppose Op = sext X, and we descale X as Y * SmallScale. We want to - // descale Op as (sext Y) * Scale. In order to have - // sext (Y * SmallScale) = (sext Y) * Scale - // some conditions need to hold however: SmallScale must sign-extend to - // Scale and the multiplication Y * SmallScale should not overflow. - if (SmallScale.sext(Scale.getBitWidth()) != Scale) - // SmallScale does not sign-extend to Scale. - return nullptr; - assert(SmallScale.exactLogBase2() == logScale); - // Require that Y * SmallScale must not overflow. - RequireNoSignedWrap = true; - - // Drill down through the cast. - Parent = std::make_pair(Cast, 0); - Scale = SmallScale; - continue; - } - - if (Cast->getOpcode() == Instruction::Trunc) { - // Op is truncated from a larger type, descale in the larger type. - // Suppose Op = trunc X, and we descale X as Y * sext Scale. Then - // trunc (Y * sext Scale) = (trunc Y) * Scale - // always holds. However (trunc Y) * Scale may overflow even if - // trunc (Y * sext Scale) does not, so nsw flags need to be cleared - // from this point up in the expression (see later). - if (RequireNoSignedWrap) - return nullptr; - - // Drill down through the cast. - unsigned LargeSize = Cast->getSrcTy()->getPrimitiveSizeInBits(); - Parent = std::make_pair(Cast, 0); - Scale = Scale.sext(LargeSize); - if (logScale + 1 == (int32_t)Cast->getType()->getPrimitiveSizeInBits()) - logScale = -1; - assert(Scale.exactLogBase2() == logScale); - continue; - } - } - - // Unsupported expression, bail out. - return nullptr; - } - - // If Op is zero then Val = Op * Scale. - if (match(Op, m_Zero())) { - NoSignedWrap = true; - return Op; - } - - // We know that we can successfully descale, so from here on we can safely - // modify the IR. Op holds the descaled version of the deepest term in the - // expression. NoSignedWrap is 'true' if multiplying Op by Scale is known - // not to overflow. - - if (!Parent.first) - // The expression only had one term. - return Op; - - // Rewrite the parent using the descaled version of its operand. - assert(Parent.first->hasOneUse() && "Drilled down when more than one use!"); - assert(Op != Parent.first->getOperand(Parent.second) && - "Descaling was a no-op?"); - replaceOperand(*Parent.first, Parent.second, Op); - Worklist.push(Parent.first); - - // Now work back up the expression correcting nsw flags. The logic is based - // on the following observation: if X * Y is known not to overflow as a signed - // multiplication, and Y is replaced by a value Z with smaller absolute value, - // then X * Z will not overflow as a signed multiplication either. As we work - // our way up, having NoSignedWrap 'true' means that the descaled value at the - // current level has strictly smaller absolute value than the original. - Instruction *Ancestor = Parent.first; - do { - if (BinaryOperator *BO = dyn_cast(Ancestor)) { - // If the multiplication wasn't nsw then we can't say anything about the - // value of the descaled multiplication, and we have to clear nsw flags - // from this point on up. - bool OpNoSignedWrap = BO->hasNoSignedWrap(); - NoSignedWrap &= OpNoSignedWrap; - if (NoSignedWrap != OpNoSignedWrap) { - BO->setHasNoSignedWrap(NoSignedWrap); - Worklist.push(Ancestor); - } - } else if (Ancestor->getOpcode() == Instruction::Trunc) { - // The fact that the descaled input to the trunc has smaller absolute - // value than the original input doesn't tell us anything useful about - // the absolute values of the truncations. - NoSignedWrap = false; - } - assert((Ancestor->getOpcode() != Instruction::SExt || NoSignedWrap) && - "Failed to keep proper track of nsw flags while drilling down?"); - - if (Ancestor == Val) - // Got to the top, all done! - return Val; - - // Move up one level in the expression. - assert(Ancestor->hasOneUse() && "Drilled down when more than one use!"); - Ancestor = Ancestor->user_back(); - } while (true); -} -#endif // INTEL_SYCL_OPAQUEPOINTER_READY - Instruction *InstCombinerImpl::foldVectorBinop(BinaryOperator &Inst) { if (!isa(Inst.getType())) return nullptr; @@ -2254,11 +1986,7 @@ Instruction *InstCombinerImpl::visitGEPOfGEP(GetElementPtrInst &GEP, // For constant GEPs, use a more general offset-based folding approach. // Only do this for opaque pointers, as the result element type may change. Type *PtrTy = Src->getType()->getScalarType(); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY if (GEP.hasAllConstantIndices() && -#else // INTEL_SYCL_OPAQUEPOINTER_READY - if (PtrTy->isOpaquePointerTy() && GEP.hasAllConstantIndices() && -#endif // INTEL_SYCL_OPAQUEPOINTER_READY (Src->hasOneUse() || Src->hasAllConstantIndices())) { // Split Src into a variable part and a constant suffix. gep_type_iterator GTI = gep_type_begin(*Src); @@ -2386,113 +2114,6 @@ Instruction *InstCombinerImpl::visitGEPOfGEP(GetElementPtrInst &GEP, return nullptr; } -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY -// Note that we may have also stripped an address space cast in between. -Instruction *InstCombinerImpl::visitGEPOfBitcast(BitCastInst *BCI, - GetElementPtrInst &GEP) { - // With opaque pointers, there is no pointer element type we can use to - // adjust the GEP type. - PointerType *SrcType = cast(BCI->getSrcTy()); - if (SrcType->isOpaque()) - return nullptr; - - Type *GEPEltType = GEP.getSourceElementType(); - Type *SrcEltType = SrcType->getNonOpaquePointerElementType(); - Value *SrcOp = BCI->getOperand(0); - - // GEP directly using the source operand if this GEP is accessing an element - // of a bitcasted pointer to vector or array of the same dimensions: - // gep (bitcast * X to [c x ty]*), Y, Z --> gep X, Y, Z - // gep (bitcast [c x ty]* X to *), Y, Z --> gep X, Y, Z - auto areMatchingArrayAndVecTypes = [](Type *ArrTy, Type *VecTy, - const DataLayout &DL) { - auto *VecVTy = cast(VecTy); - return ArrTy->getArrayElementType() == VecVTy->getElementType() && - ArrTy->getArrayNumElements() == VecVTy->getNumElements() && - DL.getTypeAllocSize(ArrTy) == DL.getTypeAllocSize(VecTy); - }; - if (GEP.getNumOperands() == 3 && - ((GEPEltType->isArrayTy() && isa(SrcEltType) && - areMatchingArrayAndVecTypes(GEPEltType, SrcEltType, DL)) || - (isa(GEPEltType) && SrcEltType->isArrayTy() && - areMatchingArrayAndVecTypes(SrcEltType, GEPEltType, DL)))) { - - // Create a new GEP here, as using `setOperand()` followed by - // `setSourceElementType()` won't actually update the type of the - // existing GEP Value. Causing issues if this Value is accessed when - // constructing an AddrSpaceCastInst - SmallVector Indices(GEP.indices()); - Value *NGEP = - Builder.CreateGEP(SrcEltType, SrcOp, Indices, "", GEP.isInBounds()); - NGEP->takeName(&GEP); - - // Preserve GEP address space to satisfy users - if (NGEP->getType()->getPointerAddressSpace() != GEP.getAddressSpace()) - return new AddrSpaceCastInst(NGEP, GEP.getType()); - - return replaceInstUsesWith(GEP, NGEP); - } - - // See if we can simplify: - // X = bitcast A* to B* - // Y = gep X, <...constant indices...> - // into a gep of the original struct. This is important for SROA and alias - // analysis of unions. If "A" is also a bitcast, wait for A/X to be merged. - unsigned OffsetBits = DL.getIndexTypeSizeInBits(GEP.getType()); - APInt Offset(OffsetBits, 0); - - // If the bitcast argument is an allocation, The bitcast is for convertion - // to actual type of allocation. Removing such bitcasts, results in having - // GEPs with i8* base and pure byte offsets. That means GEP is not aware of - // struct or array hierarchy. - // By avoiding such GEPs, phi translation and MemoryDependencyAnalysis have - // a better chance to succeed. - if (!isa(SrcOp) && GEP.accumulateConstantOffset(DL, Offset) && - !isAllocationFn(SrcOp, &TLI)) { - // If this GEP instruction doesn't move the pointer, just replace the GEP - // with a bitcast of the real input to the dest type. - if (!Offset) { - // If the bitcast is of an allocation, and the allocation will be - // converted to match the type of the cast, don't touch this. - if (isa(SrcOp)) { - // See if the bitcast simplifies, if so, don't nuke this GEP yet. - if (Instruction *I = visitBitCast(*BCI)) { - if (I != BCI) { - I->takeName(BCI); - I->insertInto(BCI->getParent(), BCI->getIterator()); - replaceInstUsesWith(*BCI, I); - } - return &GEP; - } - } - - if (SrcType->getPointerAddressSpace() != GEP.getAddressSpace()) - return new AddrSpaceCastInst(SrcOp, GEP.getType()); - return new BitCastInst(SrcOp, GEP.getType()); - } - - // Otherwise, if the offset is non-zero, we need to find out if there is a - // field at Offset in 'A's type. If so, we can pull the cast through the - // GEP. - SmallVector NewIndices; - if (findElementAtOffset(SrcType, Offset.getSExtValue(), NewIndices, DL)) { - Value *NGEP = Builder.CreateGEP(SrcEltType, SrcOp, NewIndices, "", - GEP.isInBounds()); - - if (NGEP->getType() == GEP.getType()) - return replaceInstUsesWith(GEP, NGEP); - NGEP->takeName(&GEP); - - if (NGEP->getType()->getPointerAddressSpace() != GEP.getAddressSpace()) - return new AddrSpaceCastInst(NGEP, GEP.getType()); - return new BitCastInst(NGEP, GEP.getType()); - } - } - - return nullptr; -} -#endif // INTEL_SYCL_OPAQUEPOINTER_READY - Instruction *InstCombinerImpl::visitGetElementPtrInst(GetElementPtrInst &GEP) { Value *PtrOp = GEP.getOperand(0); SmallVector Indices(GEP.indices()); @@ -2714,193 +2335,6 @@ Instruction *InstCombinerImpl::visitGetElementPtrInst(GetElementPtrInst &GEP) { if (GEPType->isVectorTy()) return nullptr; -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - // Handle gep(bitcast x) and gep(gep x, 0, 0, 0). - Value *StrippedPtr = PtrOp->stripPointerCasts(); - PointerType *StrippedPtrTy = cast(StrippedPtr->getType()); - - // TODO: The basic approach of these folds is not compatible with opaque - // pointers, because we can't use bitcasts as a hint for a desirable GEP - // type. Instead, we should perform canonicalization directly on the GEP - // type. For now, skip these. - if (StrippedPtr != PtrOp && !StrippedPtrTy->isOpaque()) { - bool HasZeroPointerIndex = false; - Type *StrippedPtrEltTy = StrippedPtrTy->getNonOpaquePointerElementType(); - - if (auto *C = dyn_cast(GEP.getOperand(1))) - HasZeroPointerIndex = C->isZero(); - - // Transform: GEP (bitcast [10 x i8]* X to [0 x i8]*), i32 0, ... - // into : GEP [10 x i8]* X, i32 0, ... - // - // Likewise, transform: GEP (bitcast i8* X to [0 x i8]*), i32 0, ... - // into : GEP i8* X, ... - // - // This occurs when the program declares an array extern like "int X[];" - if (HasZeroPointerIndex) { - if (auto *CATy = dyn_cast(GEPEltType)) { - // GEP (bitcast i8* X to [0 x i8]*), i32 0, ... ? - if (CATy->getElementType() == StrippedPtrEltTy) { - // -> GEP i8* X, ... - SmallVector Idx(drop_begin(GEP.indices())); - GetElementPtrInst *Res = GetElementPtrInst::Create( - StrippedPtrEltTy, StrippedPtr, Idx, GEP.getName()); - Res->setIsInBounds(GEP.isInBounds()); - if (StrippedPtrTy->getAddressSpace() == GEP.getAddressSpace()) - return Res; - // Insert Res, and create an addrspacecast. - // e.g., - // GEP (addrspacecast i8 addrspace(1)* X to [0 x i8]*), i32 0, ... - // -> - // %0 = GEP i8 addrspace(1)* X, ... - // addrspacecast i8 addrspace(1)* %0 to i8* - return new AddrSpaceCastInst(Builder.Insert(Res), GEPType); - } - - if (auto *XATy = dyn_cast(StrippedPtrEltTy)) { - // GEP (bitcast [10 x i8]* X to [0 x i8]*), i32 0, ... ? - if (CATy->getElementType() == XATy->getElementType()) { - // -> GEP [10 x i8]* X, i32 0, ... - // At this point, we know that the cast source type is a pointer - // to an array of the same type as the destination pointer - // array. Because the array type is never stepped over (there - // is a leading zero) we can fold the cast into this GEP. - if (StrippedPtrTy->getAddressSpace() == GEP.getAddressSpace()) { - GEP.setSourceElementType(XATy); - return replaceOperand(GEP, 0, StrippedPtr); - } - // Cannot replace the base pointer directly because StrippedPtr's - // address space is different. Instead, create a new GEP followed by - // an addrspacecast. - // e.g., - // GEP (addrspacecast [10 x i8] addrspace(1)* X to [0 x i8]*), - // i32 0, ... - // -> - // %0 = GEP [10 x i8] addrspace(1)* X, ... - // addrspacecast i8 addrspace(1)* %0 to i8* - SmallVector Idx(GEP.indices()); - Value *NewGEP = - Builder.CreateGEP(StrippedPtrEltTy, StrippedPtr, Idx, - GEP.getName(), GEP.isInBounds()); - return new AddrSpaceCastInst(NewGEP, GEPType); - } - } - } - } else if (GEP.getNumOperands() == 2 && !IsGEPSrcEleScalable) { - // Skip if GEP source element type is scalable. The type alloc size is - // unknown at compile-time. - // Transform things like: %t = getelementptr i32* - // bitcast ([2 x i32]* %str to i32*), i32 %V into: %t1 = getelementptr [2 - // x i32]* %str, i32 0, i32 %V; bitcast - if (StrippedPtrEltTy->isArrayTy() && - DL.getTypeAllocSize(StrippedPtrEltTy->getArrayElementType()) == - DL.getTypeAllocSize(GEPEltType)) { - Type *IdxType = DL.getIndexType(GEPType); - Value *Idx[2] = {Constant::getNullValue(IdxType), GEP.getOperand(1)}; - Value *NewGEP = Builder.CreateGEP(StrippedPtrEltTy, StrippedPtr, Idx, - GEP.getName(), GEP.isInBounds()); - - // V and GEP are both pointer types --> BitCast - return CastInst::CreatePointerBitCastOrAddrSpaceCast(NewGEP, GEPType); - } - - // Transform things like: - // %V = mul i64 %N, 4 - // %t = getelementptr i8* bitcast (i32* %arr to i8*), i32 %V - // into: %t1 = getelementptr i32* %arr, i32 %N; bitcast - if (GEPEltType->isSized() && StrippedPtrEltTy->isSized()) { - // Check that changing the type amounts to dividing the index by a scale - // factor. - uint64_t ResSize = DL.getTypeAllocSize(GEPEltType).getFixedValue(); - uint64_t SrcSize = - DL.getTypeAllocSize(StrippedPtrEltTy).getFixedValue(); - if (ResSize && SrcSize % ResSize == 0) { - Value *Idx = GEP.getOperand(1); - unsigned BitWidth = Idx->getType()->getPrimitiveSizeInBits(); - uint64_t Scale = SrcSize / ResSize; - - // Earlier transforms ensure that the index has the right type - // according to Data Layout, which considerably simplifies the - // logic by eliminating implicit casts. - assert(Idx->getType() == DL.getIndexType(GEPType) && - "Index type does not match the Data Layout preferences"); - - bool NSW; - if (Value *NewIdx = Descale(Idx, APInt(BitWidth, Scale), NSW)) { - // Successfully decomposed Idx as NewIdx * Scale, form a new GEP. - // If the multiplication NewIdx * Scale may overflow then the new - // GEP may not be "inbounds". - Value *NewGEP = - Builder.CreateGEP(StrippedPtrEltTy, StrippedPtr, NewIdx, - GEP.getName(), GEP.isInBounds() && NSW); - - // The NewGEP must be pointer typed, so must the old one -> BitCast - return CastInst::CreatePointerBitCastOrAddrSpaceCast(NewGEP, - GEPType); - } - } - } - - // Similarly, transform things like: - // getelementptr i8* bitcast ([100 x double]* X to i8*), i32 %tmp - // (where tmp = 8*tmp2) into: - // getelementptr [100 x double]* %arr, i32 0, i32 %tmp2; bitcast - if (GEPEltType->isSized() && StrippedPtrEltTy->isSized() && - StrippedPtrEltTy->isArrayTy()) { - // Check that changing to the array element type amounts to dividing the - // index by a scale factor. - uint64_t ResSize = DL.getTypeAllocSize(GEPEltType).getFixedValue(); - uint64_t ArrayEltSize = - DL.getTypeAllocSize(StrippedPtrEltTy->getArrayElementType()) - .getFixedValue(); - if (ResSize && ArrayEltSize % ResSize == 0) { - Value *Idx = GEP.getOperand(1); - unsigned BitWidth = Idx->getType()->getPrimitiveSizeInBits(); - uint64_t Scale = ArrayEltSize / ResSize; - - // Earlier transforms ensure that the index has the right type - // according to the Data Layout, which considerably simplifies - // the logic by eliminating implicit casts. - assert(Idx->getType() == DL.getIndexType(GEPType) && - "Index type does not match the Data Layout preferences"); - - bool NSW; - if (Value *NewIdx = Descale(Idx, APInt(BitWidth, Scale), NSW)) { - // Successfully decomposed Idx as NewIdx * Scale, form a new GEP. - // If the multiplication NewIdx * Scale may overflow then the new - // GEP may not be "inbounds". - Type *IndTy = DL.getIndexType(GEPType); - Value *Off[2] = {Constant::getNullValue(IndTy), NewIdx}; - - Value *NewGEP = - Builder.CreateGEP(StrippedPtrEltTy, StrippedPtr, Off, - GEP.getName(), GEP.isInBounds() && NSW); - // The NewGEP must be pointer typed, so must the old one -> BitCast - return CastInst::CreatePointerBitCastOrAddrSpaceCast(NewGEP, - GEPType); - } - } - } - } - } - // addrspacecast between types is canonicalized as a bitcast, then an - // addrspacecast. To take advantage of the below bitcast + struct GEP, look - // through the addrspacecast. - Value *ASCStrippedPtrOp = PtrOp; - if (auto *ASC = dyn_cast(PtrOp)) { - // X = bitcast A addrspace(1)* to B addrspace(1)* - // Y = addrspacecast A addrspace(1)* to B addrspace(2)* - // Z = gep Y, <...constant indices...> - // Into an addrspacecasted GEP of the struct. - if (auto *BC = dyn_cast(ASC->getOperand(0))) - ASCStrippedPtrOp = BC; - } - - if (auto *BCI = dyn_cast(ASCStrippedPtrOp)) - if (Instruction *I = visitGEPOfBitcast(BCI, GEP)) - return I; -#endif // INTEL_SYCL_OPAQUEPOINTER_READY - if (!GEP.isInBounds()) { unsigned IdxWidth = DL.getIndexSizeInBits(PtrOp->getType()->getPointerAddressSpace()); diff --git a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp index f25adc1e3e310..74e9a387ea91e 100644 --- a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp +++ b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp @@ -1053,13 +1053,8 @@ FunctionCallee GCOVProfiler::getEmitFunctionFunc(const TargetLibraryInfo *TLI) { FunctionCallee GCOVProfiler::getEmitArcsFunc(const TargetLibraryInfo *TLI) { Type *Args[] = { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Type::getInt32Ty(*Ctx), // uint32_t num_counters PointerType::getUnqual(*Ctx), // uint64_t *counters -#else //INTEL_SYCL_OPAQUEPOINTER_READY - Type::getInt32Ty(*Ctx), // uint32_t num_counters - Type::getInt64PtrTy(*Ctx), // uint64_t *counters -#endif //INTEL_SYCL_OPAQUEPOINTER_READY }; FunctionType *FTy = FunctionType::get(Type::getVoidTy(*Ctx), Args, false); return M->getOrInsertFunction("llvm_gcda_emit_arcs", FTy, diff --git a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp index 504087bf41785..303a97c1b9923 100644 --- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp @@ -4900,11 +4900,7 @@ struct VarArgAMD64Helper : public VarArgHelper { NextNodeIRBuilder IRB(OrigInst); Value *VAListTag = OrigInst->getArgOperand(0); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Type *RegSaveAreaPtrTy = PointerType::getUnqual(*MS.C); // i64* -#else //INTEL_SYCL_OPAQUEPOINTER_READY - Type *RegSaveAreaPtrTy = Type::getInt64PtrTy(*MS.C); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY Value *RegSaveAreaPtrPtr = IRB.CreateIntToPtr( IRB.CreateAdd(IRB.CreatePtrToInt(VAListTag, MS.IntptrTy), ConstantInt::get(MS.IntptrTy, 16)), @@ -4921,11 +4917,7 @@ struct VarArgAMD64Helper : public VarArgHelper { if (MS.TrackOrigins) IRB.CreateMemCpy(RegSaveAreaOriginPtr, Alignment, VAArgTLSOriginCopy, Alignment, AMD64FpEndOffset); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Type *OverflowArgAreaPtrTy = PointerType::getUnqual(*MS.C); // i64* -#else //INTEL_SYCL_OPAQUEPOINTER_READY - Type *OverflowArgAreaPtrTy = Type::getInt64PtrTy(*MS.C); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY Value *OverflowArgAreaPtrPtr = IRB.CreateIntToPtr( IRB.CreateAdd(IRB.CreatePtrToInt(VAListTag, MS.IntptrTy), ConstantInt::get(MS.IntptrTy, 8)), @@ -5057,11 +5049,7 @@ struct VarArgMIPS64Helper : public VarArgHelper { CallInst *OrigInst = VAStartInstrumentationList[i]; NextNodeIRBuilder IRB(OrigInst); Value *VAListTag = OrigInst->getArgOperand(0); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Type *RegSaveAreaPtrTy = PointerType::getUnqual(*MS.C); // i64* -#else //INTEL_SYCL_OPAQUEPOINTER_READY - Type *RegSaveAreaPtrTy = Type::getInt64PtrTy(*MS.C); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY Value *RegSaveAreaPtrPtr = IRB.CreateIntToPtr(IRB.CreatePtrToInt(VAListTag, MS.IntptrTy), PointerType::get(RegSaveAreaPtrTy, 0)); @@ -5212,11 +5200,7 @@ struct VarArgAArch64Helper : public VarArgHelper { Value *SaveAreaPtrPtr = IRB.CreateIntToPtr( IRB.CreateAdd(IRB.CreatePtrToInt(VAListTag, MS.IntptrTy), ConstantInt::get(MS.IntptrTy, offset)), -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Type::getInt64PtrTy(*MS.C)); -#else PointerType::get(*MS.C, 0)); -#endif return IRB.CreateLoad(Type::getInt64Ty(*MS.C), SaveAreaPtrPtr); } @@ -5225,11 +5209,7 @@ struct VarArgAArch64Helper : public VarArgHelper { Value *SaveAreaPtr = IRB.CreateIntToPtr( IRB.CreateAdd(IRB.CreatePtrToInt(VAListTag, MS.IntptrTy), ConstantInt::get(MS.IntptrTy, offset)), -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Type::getInt32PtrTy(*MS.C)); -#else PointerType::get(*MS.C, 0)); -#endif Value *SaveArea32 = IRB.CreateLoad(IRB.getInt32Ty(), SaveAreaPtr); return IRB.CreateSExt(SaveArea32, MS.IntptrTy); } @@ -5516,11 +5496,7 @@ struct VarArgPowerPC64Helper : public VarArgHelper { CallInst *OrigInst = VAStartInstrumentationList[i]; NextNodeIRBuilder IRB(OrigInst); Value *VAListTag = OrigInst->getArgOperand(0); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Type *RegSaveAreaPtrTy = PointerType::getUnqual(*MS.C); // i64* -#else //INTEL_SYCL_OPAQUEPOINTER_READY - Type *RegSaveAreaPtrTy = Type::getInt64PtrTy(*MS.C); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY Value *RegSaveAreaPtrPtr = IRB.CreateIntToPtr(IRB.CreatePtrToInt(VAListTag, MS.IntptrTy), PointerType::get(RegSaveAreaPtrTy, 0)); @@ -5765,11 +5741,7 @@ struct VarArgSystemZHelper : public VarArgHelper { void visitVACopyInst(VACopyInst &I) override { unpoisonVAListTagForInst(I); } void copyRegSaveArea(IRBuilder<> &IRB, Value *VAListTag) { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Type *RegSaveAreaPtrTy = PointerType::getUnqual(*MS.C); // i64* -#else //INTEL_SYCL_OPAQUEPOINTER_READY - Type *RegSaveAreaPtrTy = Type::getInt64PtrTy(*MS.C); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY Value *RegSaveAreaPtrPtr = IRB.CreateIntToPtr( IRB.CreateAdd( IRB.CreatePtrToInt(VAListTag, MS.IntptrTy), @@ -5794,11 +5766,7 @@ struct VarArgSystemZHelper : public VarArgHelper { } void copyOverflowArea(IRBuilder<> &IRB, Value *VAListTag) { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Type *OverflowArgAreaPtrTy = PointerType::getUnqual(*MS.C); // i64* -#else //INTEL_SYCL_OPAQUEPOINTER_READY - Type *OverflowArgAreaPtrTy = Type::getInt64PtrTy(*MS.C); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY Value *OverflowArgAreaPtrPtr = IRB.CreateIntToPtr( IRB.CreateAdd( IRB.CreatePtrToInt(VAListTag, MS.IntptrTy), diff --git a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp index c269690721f0b..edb61e5214a64 100644 --- a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp +++ b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp @@ -261,13 +261,7 @@ class ModuleSanitizerCoverage { FunctionCallee SanCovTraceGepFunction; FunctionCallee SanCovTraceSwitchFunction; GlobalVariable *SanCovLowestStack; -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Type *PtrTy, *IntptrTy, *Int64Ty, *Int32Ty, *Int16Ty, *Int8Ty, *Int1Ty; -#else //INTEL_SYCL_OPAQUEPOINTER_READY - Type *Int128PtrTy, *IntptrTy, *IntptrPtrTy, *Int64Ty, *Int64PtrTy, *Int32Ty, - *Int32PtrTy, *Int16PtrTy, *Int16Ty, *Int8Ty, *Int8PtrTy, *Int1Ty, - *Int1PtrTy; -#endif //INTEL_SYCL_OPAQUEPOINTER_READY Module *CurModule; std::string CurModuleUniqueId; Triple TargetTriple; @@ -335,19 +329,10 @@ ModuleSanitizerCoverage::CreateSecStartEnd(Module &M, const char *Section, // Account for the fact that on windows-msvc __start_* symbols actually // point to a uint64_t before the start of the array. -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY auto SecStartI8Ptr = IRB.CreatePointerCast(SecStart, PtrTy); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - auto SecStartI8Ptr = IRB.CreatePointerCast(SecStart, Int8PtrTy); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY auto GEP = IRB.CreateGEP(Int8Ty, SecStartI8Ptr, ConstantInt::get(IntptrTy, sizeof(uint64_t))); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY return std::make_pair(GEP, SecEnd); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - return std::make_pair(IRB.CreatePointerCast(GEP, PointerType::getUnqual(Ty)), - SecEnd); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY } Function *ModuleSanitizerCoverage::CreateInitCallsForSections( @@ -357,9 +342,6 @@ Function *ModuleSanitizerCoverage::CreateInitCallsForSections( auto SecStart = SecStartEnd.first; auto SecEnd = SecStartEnd.second; Function *CtorFunc; -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Type *PtrTy = PointerType::getUnqual(Ty); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY std::tie(CtorFunc, std::ignore) = createSanitizerCtorAndInitFunctions( M, CtorName, InitFunctionName, {PtrTy, PtrTy}, {SecStart, SecEnd}); assert(CtorFunc->getName() == CtorName); @@ -405,21 +387,9 @@ bool ModuleSanitizerCoverage::instrumentModule( FunctionPCsArray = nullptr; FunctionCFsArray = nullptr; IntptrTy = Type::getIntNTy(*C, DL->getPointerSizeInBits()); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY PtrTy = PointerType::getUnqual(*C); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - IntptrPtrTy = PointerType::getUnqual(IntptrTy); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY Type *VoidTy = Type::getVoidTy(*C); IRBuilder<> IRB(*C); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Int128PtrTy = PointerType::getUnqual(IRB.getInt128Ty()); - Int64PtrTy = PointerType::getUnqual(IRB.getInt64Ty()); - Int16PtrTy = PointerType::getUnqual(IRB.getInt16Ty()); - Int32PtrTy = PointerType::getUnqual(IRB.getInt32Ty()); - Int8PtrTy = PointerType::getUnqual(IRB.getInt8Ty()); - Int1PtrTy = PointerType::getUnqual(IRB.getInt1Ty()); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY Int64Ty = IRB.getInt64Ty(); Int32Ty = IRB.getInt32Ty(); Int16Ty = IRB.getInt16Ty(); @@ -458,66 +428,17 @@ bool ModuleSanitizerCoverage::instrumentModule( M.getOrInsertFunction(SanCovTraceConstCmp8, VoidTy, Int64Ty, Int64Ty); // Loads. -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY SanCovLoadFunction[0] = M.getOrInsertFunction(SanCovLoad1, VoidTy, PtrTy); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - SanCovLoadFunction[0] = M.getOrInsertFunction(SanCovLoad1, VoidTy, Int8PtrTy); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY - SanCovLoadFunction[1] = -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - M.getOrInsertFunction(SanCovLoad2, VoidTy, PtrTy); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - M.getOrInsertFunction(SanCovLoad2, VoidTy, Int16PtrTy); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY - SanCovLoadFunction[2] = -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - M.getOrInsertFunction(SanCovLoad4, VoidTy, PtrTy); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - M.getOrInsertFunction(SanCovLoad4, VoidTy, Int32PtrTy); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY - SanCovLoadFunction[3] = -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - M.getOrInsertFunction(SanCovLoad8, VoidTy, PtrTy); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - M.getOrInsertFunction(SanCovLoad8, VoidTy, Int64PtrTy); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY - SanCovLoadFunction[4] = -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - M.getOrInsertFunction(SanCovLoad16, VoidTy, PtrTy); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - M.getOrInsertFunction(SanCovLoad16, VoidTy, Int128PtrTy); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY + SanCovLoadFunction[1] = M.getOrInsertFunction(SanCovLoad2, VoidTy, PtrTy); + SanCovLoadFunction[2] = M.getOrInsertFunction(SanCovLoad4, VoidTy, PtrTy); + SanCovLoadFunction[3] = M.getOrInsertFunction(SanCovLoad8, VoidTy, PtrTy); + SanCovLoadFunction[4] = M.getOrInsertFunction(SanCovLoad16, VoidTy, PtrTy); // Stores. - SanCovStoreFunction[0] = -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - M.getOrInsertFunction(SanCovStore1, VoidTy, PtrTy); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - M.getOrInsertFunction(SanCovStore1, VoidTy, Int8PtrTy); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY - SanCovStoreFunction[1] = -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - M.getOrInsertFunction(SanCovStore2, VoidTy, PtrTy); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - M.getOrInsertFunction(SanCovStore2, VoidTy, Int16PtrTy); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY - SanCovStoreFunction[2] = -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - M.getOrInsertFunction(SanCovStore4, VoidTy, PtrTy); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - M.getOrInsertFunction(SanCovStore4, VoidTy, Int32PtrTy); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY - SanCovStoreFunction[3] = -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - M.getOrInsertFunction(SanCovStore8, VoidTy, PtrTy); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - M.getOrInsertFunction(SanCovStore8, VoidTy, Int64PtrTy); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY - SanCovStoreFunction[4] = -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - M.getOrInsertFunction(SanCovStore16, VoidTy, PtrTy); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - M.getOrInsertFunction(SanCovStore16, VoidTy, Int128PtrTy); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY + SanCovStoreFunction[0] = M.getOrInsertFunction(SanCovStore1, VoidTy, PtrTy); + SanCovStoreFunction[1] = M.getOrInsertFunction(SanCovStore2, VoidTy, PtrTy); + SanCovStoreFunction[2] = M.getOrInsertFunction(SanCovStore4, VoidTy, PtrTy); + SanCovStoreFunction[3] = M.getOrInsertFunction(SanCovStore8, VoidTy, PtrTy); + SanCovStoreFunction[4] = M.getOrInsertFunction(SanCovStore16, VoidTy, PtrTy); { AttributeList AL; @@ -530,11 +451,7 @@ bool ModuleSanitizerCoverage::instrumentModule( SanCovTraceGepFunction = M.getOrInsertFunction(SanCovTraceGep, VoidTy, IntptrTy); SanCovTraceSwitchFunction = -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY M.getOrInsertFunction(SanCovTraceSwitchName, VoidTy, Int64Ty, PtrTy); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - M.getOrInsertFunction(SanCovTraceSwitchName, VoidTy, Int64Ty, Int64PtrTy); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY Constant *SanCovLowestStackConstant = M.getOrInsertGlobal(SanCovLowestStackName, IntptrTy); @@ -551,11 +468,7 @@ bool ModuleSanitizerCoverage::instrumentModule( SanCovTracePC = M.getOrInsertFunction(SanCovTracePCName, VoidTy); SanCovTracePCGuard = -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY M.getOrInsertFunction(SanCovTracePCGuardName, VoidTy, PtrTy); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - M.getOrInsertFunction(SanCovTracePCGuardName, VoidTy, Int32PtrTy); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY for (auto &F : M) instrumentFunction(F, DTCallback, PDTCallback); @@ -577,24 +490,16 @@ bool ModuleSanitizerCoverage::instrumentModule( } if (Ctor && Options.PCTable) { auto SecStartEnd = CreateSecStartEnd(M, SanCovPCsSectionName, IntptrTy); - FunctionCallee InitFunction = declareSanitizerInitFunction( -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - M, SanCovPCsInitName, {PtrTy, PtrTy}); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - M, SanCovPCsInitName, {IntptrPtrTy, IntptrPtrTy}); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY + FunctionCallee InitFunction = + declareSanitizerInitFunction(M, SanCovPCsInitName, {PtrTy, PtrTy}); IRBuilder<> IRBCtor(Ctor->getEntryBlock().getTerminator()); IRBCtor.CreateCall(InitFunction, {SecStartEnd.first, SecStartEnd.second}); } if (Ctor && Options.CollectControlFlow) { auto SecStartEnd = CreateSecStartEnd(M, SanCovCFsSectionName, IntptrTy); - FunctionCallee InitFunction = declareSanitizerInitFunction( -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - M, SanCovCFsInitName, {PtrTy, PtrTy}); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - M, SanCovCFsInitName, {IntptrPtrTy, IntptrPtrTy}); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY + FunctionCallee InitFunction = + declareSanitizerInitFunction(M, SanCovCFsInitName, {PtrTy, PtrTy}); IRBuilder<> IRBCtor(Ctor->getEntryBlock().getTerminator()); IRBCtor.CreateCall(InitFunction, {SecStartEnd.first, SecStartEnd.second}); } @@ -820,40 +725,19 @@ ModuleSanitizerCoverage::CreatePCArray(Function &F, IRBuilder<> IRB(&*F.getEntryBlock().getFirstInsertionPt()); for (size_t i = 0; i < N; i++) { if (&F.getEntryBlock() == AllBlocks[i]) { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY PCs.push_back((Constant *)IRB.CreatePointerCast(&F, PtrTy)); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - PCs.push_back((Constant *)IRB.CreatePointerCast(&F, IntptrPtrTy)); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY - PCs.push_back((Constant *)IRB.CreateIntToPtr( -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - ConstantInt::get(IntptrTy, 1), PtrTy)); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - ConstantInt::get(IntptrTy, 1), IntptrPtrTy)); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY + PCs.push_back( + (Constant *)IRB.CreateIntToPtr(ConstantInt::get(IntptrTy, 1), PtrTy)); } else { PCs.push_back((Constant *)IRB.CreatePointerCast( -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY BlockAddress::get(AllBlocks[i]), PtrTy)); PCs.push_back(Constant::getNullValue(PtrTy)); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - BlockAddress::get(AllBlocks[i]), IntptrPtrTy)); - PCs.push_back(Constant::getNullValue(IntptrPtrTy)); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY } } -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - auto *PCArray = CreateFunctionLocalArrayInSection(N * 2, F, PtrTy, -#else //INTEL_SYCL_OPAQUEPOINTER_READY - auto *PCArray = CreateFunctionLocalArrayInSection(N * 2, F, IntptrPtrTy, -#endif //INTEL_SYCL_OPAQUEPOINTER_READY - SanCovPCsSectionName); + auto *PCArray = + CreateFunctionLocalArrayInSection(N * 2, F, PtrTy, SanCovPCsSectionName); PCArray->setInitializer( -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY ConstantArray::get(ArrayType::get(PtrTy, N * 2), PCs)); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - ConstantArray::get(ArrayType::get(IntptrPtrTy, N * 2), PCs)); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY PCArray->setConstant(true); return PCArray; @@ -947,11 +831,7 @@ void ModuleSanitizerCoverage::InjectTraceForSwitch( ConstantArray::get(ArrayOfInt64Ty, Initializers), "__sancov_gen_cov_switch_values"); IRB.CreateCall(SanCovTraceSwitchFunction, -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY {Cond, IRB.CreatePointerCast(GV, PtrTy)}); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - {Cond, IRB.CreatePointerCast(GV, Int64PtrTy)}); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY } } } @@ -996,22 +876,13 @@ void ModuleSanitizerCoverage::InjectTraceForLoadsAndStores( : TypeSize == 128 ? 4 : -1; }; -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Type *PointerType[5] = {Int8PtrTy, Int16PtrTy, Int32PtrTy, Int64PtrTy, - Int128PtrTy}; -#endif //INTEL_SYCL_OPAQUEPOINTER_READY for (auto *LI : Loads) { InstrumentationIRBuilder IRB(LI); auto Ptr = LI->getPointerOperand(); int Idx = CallbackIdx(LI->getType()); if (Idx < 0) continue; -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY IRB.CreateCall(SanCovLoadFunction[Idx], Ptr); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - IRB.CreateCall(SanCovLoadFunction[Idx], - IRB.CreatePointerCast(Ptr, PointerType[Idx])); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY } for (auto *SI : Stores) { InstrumentationIRBuilder IRB(SI); @@ -1019,12 +890,7 @@ void ModuleSanitizerCoverage::InjectTraceForLoadsAndStores( int Idx = CallbackIdx(SI->getValueOperand()->getType()); if (Idx < 0) continue; -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY IRB.CreateCall(SanCovStoreFunction[Idx], Ptr); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - IRB.CreateCall(SanCovStoreFunction[Idx], - IRB.CreatePointerCast(Ptr, PointerType[Idx])); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY } } @@ -1089,11 +955,7 @@ void ModuleSanitizerCoverage::InjectCoverageAtBlock(Function &F, BasicBlock &BB, auto GuardPtr = IRB.CreateIntToPtr( IRB.CreateAdd(IRB.CreatePointerCast(FunctionGuardArray, IntptrTy), ConstantInt::get(IntptrTy, Idx * 4)), -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY PtrTy); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - Int32PtrTy); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY IRB.CreateCall(SanCovTracePCGuard, GuardPtr)->setCannotMerge(); } if (Options.Inline8bitCounters) { @@ -1123,11 +985,7 @@ void ModuleSanitizerCoverage::InjectCoverageAtBlock(Function &F, BasicBlock &BB, Module *M = F.getParent(); Function *GetFrameAddr = Intrinsic::getDeclaration( M, Intrinsic::frameaddress, -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY IRB.getPtrTy(M->getDataLayout().getAllocaAddrSpace())); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - IRB.getInt8PtrTy(M->getDataLayout().getAllocaAddrSpace())); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY auto FrameAddrPtr = IRB.CreateCall(GetFrameAddr, {Constant::getNullValue(Int32Ty)}); auto FrameAddrInt = IRB.CreatePtrToInt(FrameAddrPtr, IntptrTy); @@ -1178,76 +1036,39 @@ void ModuleSanitizerCoverage::createFunctionControlFlow(Function &F) { for (auto &BB : F) { // blockaddress can not be used on function's entry block. if (&BB == &F.getEntryBlock()) -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY CFs.push_back((Constant *)IRB.CreatePointerCast(&F, PtrTy)); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - CFs.push_back((Constant *)IRB.CreatePointerCast(&F, IntptrPtrTy)); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY else - CFs.push_back((Constant *)IRB.CreatePointerCast(BlockAddress::get(&BB), -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - PtrTy)); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - IntptrPtrTy)); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY + CFs.push_back( + (Constant *)IRB.CreatePointerCast(BlockAddress::get(&BB), PtrTy)); for (auto SuccBB : successors(&BB)) { assert(SuccBB != &F.getEntryBlock()); - CFs.push_back((Constant *)IRB.CreatePointerCast(BlockAddress::get(SuccBB), -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - PtrTy)); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - IntptrPtrTy)); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY + CFs.push_back( + (Constant *)IRB.CreatePointerCast(BlockAddress::get(SuccBB), PtrTy)); } -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY CFs.push_back((Constant *)Constant::getNullValue(PtrTy)); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - CFs.push_back((Constant *)Constant::getNullValue(IntptrPtrTy)); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY for (auto &Inst : BB) { if (CallBase *CB = dyn_cast(&Inst)) { if (CB->isIndirectCall()) { // TODO(navidem): handle indirect calls, for now mark its existence. CFs.push_back((Constant *)IRB.CreateIntToPtr( -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY ConstantInt::get(IntptrTy, -1), PtrTy)); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - ConstantInt::get(IntptrTy, -1), IntptrPtrTy)); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY } else { auto CalledF = CB->getCalledFunction(); if (CalledF && !CalledF->isIntrinsic()) - CFs.push_back( -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - (Constant *)IRB.CreatePointerCast(CalledF, PtrTy)); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - (Constant *)IRB.CreatePointerCast(CalledF, IntptrPtrTy)); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY + CFs.push_back((Constant *)IRB.CreatePointerCast(CalledF, PtrTy)); } } } -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY CFs.push_back((Constant *)Constant::getNullValue(PtrTy)); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - CFs.push_back((Constant *)Constant::getNullValue(IntptrPtrTy)); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY } - FunctionCFsArray = CreateFunctionLocalArrayInSection( -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - CFs.size(), F, PtrTy, SanCovCFsSectionName); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - CFs.size(), F, IntptrPtrTy, SanCovCFsSectionName); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY + FunctionCFsArray = CreateFunctionLocalArrayInSection(CFs.size(), F, PtrTy, + SanCovCFsSectionName); FunctionCFsArray->setInitializer( -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY ConstantArray::get(ArrayType::get(PtrTy, CFs.size()), CFs)); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - ConstantArray::get(ArrayType::get(IntptrPtrTy, CFs.size()), CFs)); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY FunctionCFsArray->setConstant(true); } diff --git a/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp b/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp index b26f446414c74..b51e4d46bffeb 100644 --- a/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp +++ b/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp @@ -933,12 +933,8 @@ void ObjCARCOpt::OptimizeIndividualCallImpl(Function &F, Instruction *Inst, if (IsNullOrUndef(CI->getArgOperand(0))) { Changed = true; new StoreInst(ConstantInt::getTrue(CI->getContext()), -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - PoisonValue::get(Type::getInt1PtrTy(CI->getContext())), CI); -#else PoisonValue::get(PointerType::getUnqual(CI->getContext())), CI); -#endif Value *NewValue = PoisonValue::get(CI->getType()); LLVM_DEBUG( dbgs() << "A null pointer-to-weak-pointer is undefined behavior." @@ -957,12 +953,8 @@ void ObjCARCOpt::OptimizeIndividualCallImpl(Function &F, Instruction *Inst, IsNullOrUndef(CI->getArgOperand(1))) { Changed = true; new StoreInst(ConstantInt::getTrue(CI->getContext()), -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - PoisonValue::get(Type::getInt1PtrTy(CI->getContext())), CI); -#else PoisonValue::get(PointerType::getUnqual(CI->getContext())), CI); -#endif Value *NewValue = PoisonValue::get(CI->getType()); LLVM_DEBUG( diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp index 37efee5a0206a..635e56ec60122 100644 --- a/llvm/lib/Transforms/Scalar/GVN.cpp +++ b/llvm/lib/Transforms/Scalar/GVN.cpp @@ -423,16 +423,9 @@ GVNPass::Expression GVNPass::ValueTable::createGEPExpr(GetElementPtrInst *GEP) { unsigned BitWidth = DL.getIndexTypeSizeInBits(PtrTy); MapVector VariableOffsets; APInt ConstantOffset(BitWidth, 0); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY if (GEP->collectOffset(DL, BitWidth, VariableOffsets, ConstantOffset)) { // Convert into offset representation, to recognize equivalent address // calculations that use different type encoding. -#else // INTEL_SYCL_OPAQUEPOINTER_READY - if (PtrTy->isOpaquePointerTy() && - GEP->collectOffset(DL, BitWidth, VariableOffsets, ConstantOffset)) { - // For opaque pointers, convert into offset representation, to recognize - // equivalent address calculations that use different type encoding. -#endif // INTEL_SYCL_OPAQUEPOINTER_READY LLVMContext &Context = GEP->getContext(); E.opcode = GEP->getOpcode(); E.type = nullptr; @@ -445,13 +438,8 @@ GVNPass::Expression GVNPass::ValueTable::createGEPExpr(GetElementPtrInst *GEP) { E.varargs.push_back( lookupOrAdd(ConstantInt::get(Context, ConstantOffset))); } else { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY // If converting to offset representation fails (for scalable vectors), // fall back to type-based implementation: -#else // INTEL_SYCL_OPAQUEPOINTER_READY - // If converting to offset representation fails (for typed pointers and - // scalable vectors), fall back to type-based implementation: -#endif // INTEL_SYCL_OPAQUEPOINTER_READY E.opcode = GEP->getOpcode(); E.type = GEP->getSourceElementType(); for (Use &Op : GEP->operands()) @@ -2002,19 +1990,12 @@ bool GVNPass::processAssumeIntrinsic(AssumeInst *IntrinsicI) { if (ConstantInt *Cond = dyn_cast(V)) { if (Cond->isZero()) { Type *Int8Ty = Type::getInt8Ty(V->getContext()); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Type *PtrTy = PointerType::get(V->getContext(), 0); -#endif // Insert a new store to null instruction before the load to indicate that // this code is not reachable. FIXME: We could insert unreachable // instruction directly because we can modify the CFG. auto *NewS = new StoreInst(PoisonValue::get(Int8Ty), -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Constant::getNullValue(Int8Ty->getPointerTo()), - IntrinsicI); -#else Constant::getNullValue(PtrTy), IntrinsicI); -#endif if (MSSAU) { const MemoryUseOrDef *FirstNonDom = nullptr; const auto *AL = diff --git a/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp b/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp index b175102fd9494..207a5f16a1a38 100644 --- a/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp +++ b/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp @@ -256,13 +256,11 @@ INITIALIZE_PASS_DEPENDENCY(TargetTransformInfoWrapperPass) INITIALIZE_PASS_END(InferAddressSpaces, DEBUG_TYPE, "Infer address spaces", false, false) -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY static Type *getPtrOrVecOfPtrsWithNewAS(Type *Ty, unsigned NewAddrSpace) { assert(Ty->isPtrOrPtrVectorTy()); PointerType *NPT = PointerType::get(Ty->getContext(), NewAddrSpace); return Ty->getWithNewType(NPT); } -#endif // Check whether that's no-op pointer bicast using a pair of // `ptrtoint`/`inttoptr` due to the missing no-op pointer bitcast over @@ -309,22 +307,14 @@ static bool isAddressExpression(const Value &V, const DataLayout &DL, switch (Op->getOpcode()) { case Instruction::PHI: -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY assert(Op->getType()->isPtrOrPtrVectorTy()); -#else - assert(Op->getType()->isPointerTy()); -#endif return true; case Instruction::BitCast: case Instruction::AddrSpaceCast: case Instruction::GetElementPtr: return true; case Instruction::Select: -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY return Op->getType()->isPtrOrPtrVectorTy(); -#else - return Op->getType()->isPointerTy(); -#endif case Instruction::Call: { const IntrinsicInst *II = dyn_cast(&V); return II && II->getIntrinsicID() == Intrinsic::ptrmask; @@ -389,7 +379,6 @@ bool InferAddressSpacesImpl::rewriteIntrinsicOperands(IntrinsicInst *II, case Intrinsic::ptrmask: // This is handled as an address expression, not as a use memory operation. return false; -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY case Intrinsic::masked_gather: { Type *RetTy = II->getType(); Type *NewPtrTy = NewV->getType(); @@ -408,7 +397,6 @@ bool InferAddressSpacesImpl::rewriteIntrinsicOperands(IntrinsicInst *II, II->setCalledFunction(NewDecl); return true; } -#endif default: { Value *Rewrite = TTI->rewriteIntrinsicWithAddressSpace(II, OldV, NewV); if (!Rewrite) @@ -430,7 +418,6 @@ void InferAddressSpacesImpl::collectRewritableIntrinsicOperands( appendsFlatAddressExpressionToPostorderStack(II->getArgOperand(0), PostorderStack, Visited); break; -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY case Intrinsic::masked_gather: appendsFlatAddressExpressionToPostorderStack(II->getArgOperand(0), PostorderStack, Visited); @@ -439,7 +426,6 @@ void InferAddressSpacesImpl::collectRewritableIntrinsicOperands( appendsFlatAddressExpressionToPostorderStack(II->getArgOperand(1), PostorderStack, Visited); break; -#endif default: SmallVector OpIndexes; if (TTI->collectFlatAddressOperands(OpIndexes, IID)) { @@ -458,11 +444,7 @@ void InferAddressSpacesImpl::collectRewritableIntrinsicOperands( void InferAddressSpacesImpl::appendsFlatAddressExpressionToPostorderStack( Value *V, PostorderStackTy &PostorderStack, DenseSet &Visited) const { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY assert(V->getType()->isPtrOrPtrVectorTy()); -#else - assert(V->getType()->isPointerTy()); -#endif // Generic addressing expressions may be hidden in nested constant // expressions. if (ConstantExpr *CE = dyn_cast(V)) { @@ -508,12 +490,7 @@ InferAddressSpacesImpl::collectFlatAddressExpressions(Function &F) const { // addressing calculations may also be faster. for (Instruction &I : instructions(F)) { if (auto *GEP = dyn_cast(&I)) { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY PushPtrOperand(GEP->getPointerOperand()); -#else - if (!GEP->getType()->isVectorTy()) - PushPtrOperand(GEP->getPointerOperand()); -#endif } else if (auto *LI = dyn_cast(&I)) PushPtrOperand(LI->getPointerOperand()); else if (auto *SI = dyn_cast(&I)) @@ -532,22 +509,12 @@ InferAddressSpacesImpl::collectFlatAddressExpressions(Function &F) const { } else if (auto *II = dyn_cast(&I)) collectRewritableIntrinsicOperands(II, PostorderStack, Visited); else if (ICmpInst *Cmp = dyn_cast(&I)) { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY if (Cmp->getOperand(0)->getType()->isPtrOrPtrVectorTy()) { -#else - // FIXME: Handle vectors of pointers - if (Cmp->getOperand(0)->getType()->isPointerTy()) { -#endif PushPtrOperand(Cmp->getOperand(0)); PushPtrOperand(Cmp->getOperand(1)); } } else if (auto *ASC = dyn_cast(&I)) { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY PushPtrOperand(ASC->getPointerOperand()); -#else - if (!ASC->getType()->isVectorTy()) - PushPtrOperand(ASC->getPointerOperand()); -#endif } else if (auto *I2P = dyn_cast(&I)) { if (isNoopPtrIntCastPair(cast(I2P), *DL, TTI)) PushPtrOperand(cast(I2P->getOperand(0))->getOperand(0)); @@ -588,12 +555,7 @@ static Value *operandWithNewAddressSpaceOrCreatePoison( SmallVectorImpl *PoisonUsesToFix) { Value *Operand = OperandUse.get(); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Type *NewPtrTy = getPtrOrVecOfPtrsWithNewAS(Operand->getType(), NewAddrSpace); -#else - Type *NewPtrTy = PointerType::getWithSamePointeeType( - cast(Operand->getType()), NewAddrSpace); -#endif if (Constant *C = dyn_cast(Operand)) return ConstantExpr::getAddrSpaceCast(C, NewPtrTy); @@ -606,12 +568,7 @@ static Value *operandWithNewAddressSpaceOrCreatePoison( if (I != PredicatedAS.end()) { // Insert an addrspacecast on that operand before the user. unsigned NewAS = I->second; -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Type *NewPtrTy = getPtrOrVecOfPtrsWithNewAS(Operand->getType(), NewAS); -#else - Type *NewPtrTy = PointerType::getWithSamePointeeType( - cast(Operand->getType()), NewAS); -#endif auto *NewI = new AddrSpaceCastInst(Operand, NewPtrTy); NewI->insertBefore(Inst); NewI->setDebugLoc(Inst->getDebugLoc()); @@ -639,12 +596,7 @@ Value *InferAddressSpacesImpl::cloneInstructionWithNewAddressSpace( const ValueToValueMapTy &ValueWithNewAddrSpace, const PredicatedAddrSpaceMapTy &PredicatedAS, SmallVectorImpl *PoisonUsesToFix) const { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Type *NewPtrType = getPtrOrVecOfPtrsWithNewAS(I->getType(), NewAddrSpace); -#else - Type *NewPtrType = PointerType::getWithSamePointeeType( - cast(I->getType()), NewAddrSpace); -#endif if (I->getOpcode() == Instruction::AddrSpaceCast) { Value *Src = I->getOperand(0); // Because `I` is flat, the source address space must be specific. @@ -677,12 +629,7 @@ Value *InferAddressSpacesImpl::cloneInstructionWithNewAddressSpace( if (AS != UninitializedAddressSpace) { // For the assumed address space, insert an `addrspacecast` to make that // explicit. -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Type *NewPtrTy = getPtrOrVecOfPtrsWithNewAS(I->getType(), AS); -#else - Type *NewPtrTy = PointerType::getWithSamePointeeType( - cast(I->getType()), AS); -#endif auto *NewI = new AddrSpaceCastInst(I, NewPtrTy); NewI->insertAfter(I); return NewI; @@ -691,11 +638,7 @@ Value *InferAddressSpacesImpl::cloneInstructionWithNewAddressSpace( // Computes the converted pointer operands. SmallVector NewPointerOperands; for (const Use &OperandUse : I->operands()) { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY if (!OperandUse.get()->getType()->isPtrOrPtrVectorTy()) -#else - if (!OperandUse.get()->getType()->isPointerTy()) -#endif NewPointerOperands.push_back(nullptr); else NewPointerOperands.push_back(operandWithNewAddressSpaceOrCreatePoison( @@ -707,11 +650,7 @@ Value *InferAddressSpacesImpl::cloneInstructionWithNewAddressSpace( case Instruction::BitCast: return new BitCastInst(NewPointerOperands[0], NewPtrType); case Instruction::PHI: { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY assert(I->getType()->isPtrOrPtrVectorTy()); -#else - assert(I->getType()->isPointerTy()); -#endif PHINode *PHI = cast(I); PHINode *NewPHI = PHINode::Create(NewPtrType, PHI->getNumIncomingValues()); for (unsigned Index = 0; Index < PHI->getNumIncomingValues(); ++Index) { @@ -730,11 +669,7 @@ Value *InferAddressSpacesImpl::cloneInstructionWithNewAddressSpace( return NewGEP; } case Instruction::Select: -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY assert(I->getType()->isPtrOrPtrVectorTy()); -#else - assert(I->getType()->isPointerTy()); -#endif return SelectInst::Create(I->getOperand(0), NewPointerOperands[1], NewPointerOperands[2], "", nullptr, I); case Instruction::IntToPtr: { @@ -760,17 +695,10 @@ static Value *cloneConstantExprWithNewAddressSpace( ConstantExpr *CE, unsigned NewAddrSpace, const ValueToValueMapTy &ValueWithNewAddrSpace, const DataLayout *DL, const TargetTransformInfo *TTI) { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Type *TargetType = CE->getType()->isPtrOrPtrVectorTy() ? getPtrOrVecOfPtrsWithNewAS(CE->getType(), NewAddrSpace) : CE->getType(); -#else - Type *TargetType = CE->getType()->isPointerTy() - ? PointerType::getWithSamePointeeType( - cast(CE->getType()), NewAddrSpace) - : CE->getType(); -#endif if (CE->getOpcode() == Instruction::AddrSpaceCast) { // Because CE is flat, the source address space must be specific. @@ -1322,22 +1250,6 @@ bool InferAddressSpacesImpl::rewriteWithNewAddressSpaces( if (AddrSpaceCastInst *ASC = dyn_cast(CurUser)) { unsigned NewAS = NewV->getType()->getPointerAddressSpace(); if (ASC->getDestAddressSpace() == NewAS) { -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - if (!cast(ASC->getType()) - ->hasSameElementTypeAs( - cast(NewV->getType()))) { - BasicBlock::iterator InsertPos; - if (Instruction *NewVInst = dyn_cast(NewV)) - InsertPos = std::next(NewVInst->getIterator()); - else if (Instruction *VInst = dyn_cast(V)) - InsertPos = std::next(VInst->getIterator()); - else - InsertPos = ASC->getIterator(); - - NewV = CastInst::Create(Instruction::BitCast, NewV, - ASC->getType(), "", &*InsertPos); - } -#endif ASC->replaceAllUsesWith(NewV); DeadInstructions.push_back(ASC); continue; diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp index 554edd2a333f3..8e66d5e922e67 100644 --- a/llvm/lib/Transforms/Scalar/LICM.cpp +++ b/llvm/lib/Transforms/Scalar/LICM.cpp @@ -1055,30 +1055,15 @@ static bool isLoadInvariantInLoop(LoadInst *LI, DominatorTree *DT, if (LocSizeInBits.isScalable()) return false; -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY // if the type is ptr addrspace(x), we know this is the type of -#else //INTEL_SYCL_OPAQUEPOINTER_READY - // if the type is i8 addrspace(x)*, we know this is the type of -#endif //INTEL_SYCL_OPAQUEPOINTER_READY // llvm.invariant.start operand -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - auto *PtrASXTy = PointerType::get(LI->getContext(), - LI->getPointerAddressSpace()); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - auto *PtrInt8Ty = PointerType::get(Type::getInt8Ty(LI->getContext()), - LI->getPointerAddressSpace()); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY + auto *PtrASXTy = + PointerType::get(LI->getContext(), LI->getPointerAddressSpace()); unsigned BitcastsVisited = 0; -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY // Look through bitcasts until we reach the PtrASXTy type (this is // invariant.start operand type). // FIXME: We shouldn't really find such bitcasts with opaque pointers. while (Addr->getType() != PtrASXTy) { -#else //INTEL_SYCL_OPAQUEPOINTER_READY - // Look through bitcasts until we reach the i8* type (this is invariant.start - // operand type). - while (Addr->getType() != PtrInt8Ty) { -#endif //INTEL_SYCL_OPAQUEPOINTER_READY auto *BC = dyn_cast(Addr); // Avoid traversing high number of bitcast uses. if (++BitcastsVisited > MaxNumUsesTraversed || !BC) diff --git a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp index e99b84911e1b7..bbe5b02ca67f9 100644 --- a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp +++ b/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp @@ -1958,33 +1958,15 @@ bool MemCpyOptPass::processByValArgument(CallBase &CB, unsigned ArgNo) { // foo(*a) // It would be invalid to transform the second memcpy into foo(*b). if (writtenBetween(MSSA, BAA, MemoryLocation::getForSource(MDep), -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY MSSA->getMemoryAccess(MDep), CallAccess)) -#else - MSSA->getMemoryAccess(MDep), MSSA->getMemoryAccess(&CB))) -#endif // INTEL_SYCL_OPAQUEPOINTER_READY return false; -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Value *TmpCast = MDep->getSource(); - if (MDep->getSource()->getType() != ByValArg->getType()) { - BitCastInst *TmpBitCast = new BitCastInst(MDep->getSource(), ByValArg->getType(), - "tmpcast", &CB); - // Set the tmpcast's DebugLoc to MDep's - TmpBitCast->setDebugLoc(MDep->getDebugLoc()); - TmpCast = TmpBitCast; - } -#endif // INTEL_SYCL_OPAQUEPOINTER_READY LLVM_DEBUG(dbgs() << "MemCpyOptPass: Forwarding memcpy to byval:\n" << " " << *MDep << "\n" << " " << CB << "\n"); // Otherwise we're good! Update the byval argument. -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY CB.setArgOperand(ArgNo, MDep->getSource()); -#else - CB.setArgOperand(ArgNo, TmpCast); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY ++NumMemCpyInstr; return true; } diff --git a/llvm/lib/Transforms/Scalar/NewGVN.cpp b/llvm/lib/Transforms/Scalar/NewGVN.cpp index fd3b6241280a5..d4e9e4c6ab74a 100644 --- a/llvm/lib/Transforms/Scalar/NewGVN.cpp +++ b/llvm/lib/Transforms/Scalar/NewGVN.cpp @@ -3717,11 +3717,7 @@ void NewGVN::deleteInstructionsInBlock(BasicBlock *BB) { Type *Int8Ty = Type::getInt8Ty(BB->getContext()); new StoreInst( PoisonValue::get(Int8Ty), -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Constant::getNullValue(PointerType::getUnqual(BB->getContext())), -#else // INTEL_SYCL_OPAQUEPOINTER_READY - Constant::getNullValue(Int8Ty->getPointerTo()), -#endif // INTEL_SYCL_OPAQUEPOINTER_READY BB->getTerminator()); } diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp index cf3924dc827a6..b0905e55de484 100644 --- a/llvm/lib/Transforms/Scalar/SROA.cpp +++ b/llvm/lib/Transforms/Scalar/SROA.cpp @@ -1635,13 +1635,6 @@ static void speculateSelectInstLoads(SelectInst &SI, LoadInst &LI, assert(LI.isSimple() && "We only speculate simple loads"); IRB.SetInsertPoint(&LI); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - if (auto *TypedPtrTy = LI.getPointerOperandType(); - !TypedPtrTy->isOpaquePointerTy() && SI.getType() != TypedPtrTy) { - TV = IRB.CreateBitOrPointerCast(TV, TypedPtrTy, ""); - FV = IRB.CreateBitOrPointerCast(FV, TypedPtrTy, ""); - } -#endif // INTEL_SYCL_OPAQUEPOINTER_READY // Fix for typed pointers auto *LoadPtrType = LI.getPointerOperandType(); if (LoadPtrType != TV->getType()) @@ -1717,13 +1710,6 @@ static void rewriteMemOpOfSelect(SelectInst &SI, T &I, } CondMemOp.insertBefore(NewMemOpBB->getTerminator()); Value *Ptr = SI.getOperand(1 + SuccIdx); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - if (auto *PtrTy = Ptr->getType(); - !PtrTy->isOpaquePointerTy() && - PtrTy != CondMemOp.getPointerOperandType()) - Ptr = BitCastInst::CreatePointerBitCastOrAddrSpaceCast( - Ptr, CondMemOp.getPointerOperandType(), "", &CondMemOp); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY CondMemOp.setOperand(I.getPointerOperandIndex(), Ptr); if (isa(I)) { CondMemOp.setName(I.getName() + (IsThen ? ".then" : ".else") + ".val"); @@ -2739,11 +2725,7 @@ class llvm::sroa::AllocaSliceRewriter if (!IsVolatile || AddrSpace == NewAI.getType()->getPointerAddressSpace()) return &NewAI; -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Type *AccessTy = IRB.getPtrTy(AddrSpace); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - Type *AccessTy = NewAI.getAllocatedType()->getPointerTo(AddrSpace); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY return IRB.CreateAddrSpaceCast(&NewAI, AccessTy); } public: diff --git a/llvm/lib/Transforms/Utils/BuildLibCalls.cpp b/llvm/lib/Transforms/Utils/BuildLibCalls.cpp index d0ba2cd6af4cb..87dd97d6f194b 100644 --- a/llvm/lib/Transforms/Utils/BuildLibCalls.cpp +++ b/llvm/lib/Transforms/Utils/BuildLibCalls.cpp @@ -1425,13 +1425,6 @@ StringRef llvm::getFloatFn(const Module *M, const TargetLibraryInfo *TLI, //- Emit LibCalls ------------------------------------------------------------// -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY -Value *llvm::castToCStr(Value *V, IRBuilderBase &B) { - unsigned AS = V->getType()->getPointerAddressSpace(); - return B.CreateBitCast(V, B.getInt8PtrTy(AS), "cstr"); -} - -#endif //INTEL_SYCL_OPAQUEPOINTER_READY static IntegerType *getIntTy(IRBuilderBase &B, const TargetLibraryInfo *TLI) { return B.getIntNTy(TLI->getIntSize()); } @@ -1464,22 +1457,13 @@ static Value *emitLibCall(LibFunc TheLibFunc, Type *ReturnType, Value *llvm::emitStrLen(Value *Ptr, IRBuilderBase &B, const DataLayout &DL, const TargetLibraryInfo *TLI) { Type *SizeTTy = getSizeTTy(B, TLI); - return emitLibCall(LibFunc_strlen, SizeTTy, -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - B.getInt8PtrTy(), Ptr, B, TLI); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - B.getInt8PtrTy(), castToCStr(Ptr, B), B, TLI); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY + return emitLibCall(LibFunc_strlen, SizeTTy, B.getInt8PtrTy(), Ptr, B, TLI); } Value *llvm::emitStrDup(Value *Ptr, IRBuilderBase &B, const TargetLibraryInfo *TLI) { - return emitLibCall(LibFunc_strdup, B.getInt8PtrTy(), B.getInt8PtrTy(), -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - Ptr, B, TLI); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - castToCStr(Ptr, B), B, TLI); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY + return emitLibCall(LibFunc_strdup, B.getInt8PtrTy(), B.getInt8PtrTy(), Ptr, B, + TLI); } Value *llvm::emitStrChr(Value *Ptr, char C, IRBuilderBase &B, @@ -1487,47 +1471,28 @@ Value *llvm::emitStrChr(Value *Ptr, char C, IRBuilderBase &B, Type *I8Ptr = B.getInt8PtrTy(); Type *IntTy = getIntTy(B, TLI); return emitLibCall(LibFunc_strchr, I8Ptr, {I8Ptr, IntTy}, -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY {Ptr, ConstantInt::get(IntTy, C)}, B, TLI); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - {castToCStr(Ptr, B), ConstantInt::get(IntTy, C)}, B, TLI); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY } Value *llvm::emitStrNCmp(Value *Ptr1, Value *Ptr2, Value *Len, IRBuilderBase &B, const DataLayout &DL, const TargetLibraryInfo *TLI) { Type *IntTy = getIntTy(B, TLI); Type *SizeTTy = getSizeTTy(B, TLI); - return emitLibCall( - LibFunc_strncmp, IntTy, - {B.getInt8PtrTy(), B.getInt8PtrTy(), SizeTTy}, -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - {Ptr1, Ptr2, Len}, B, TLI); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - {castToCStr(Ptr1, B), castToCStr(Ptr2, B), Len}, B, TLI); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY + return emitLibCall(LibFunc_strncmp, IntTy, + {B.getInt8PtrTy(), B.getInt8PtrTy(), SizeTTy}, + {Ptr1, Ptr2, Len}, B, TLI); } Value *llvm::emitStrCpy(Value *Dst, Value *Src, IRBuilderBase &B, const TargetLibraryInfo *TLI) { Type *I8Ptr = Dst->getType(); - return emitLibCall(LibFunc_strcpy, I8Ptr, {I8Ptr, I8Ptr}, -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - {Dst, Src}, B, TLI); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - {castToCStr(Dst, B), castToCStr(Src, B)}, B, TLI); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY + return emitLibCall(LibFunc_strcpy, I8Ptr, {I8Ptr, I8Ptr}, {Dst, Src}, B, TLI); } Value *llvm::emitStpCpy(Value *Dst, Value *Src, IRBuilderBase &B, const TargetLibraryInfo *TLI) { Type *I8Ptr = B.getInt8PtrTy(); - return emitLibCall(LibFunc_stpcpy, I8Ptr, {I8Ptr, I8Ptr}, -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - {Dst, Src}, B, TLI); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - {castToCStr(Dst, B), castToCStr(Src, B)}, B, TLI); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY + return emitLibCall(LibFunc_stpcpy, I8Ptr, {I8Ptr, I8Ptr}, {Dst, Src}, B, TLI); } Value *llvm::emitStrNCpy(Value *Dst, Value *Src, Value *Len, IRBuilderBase &B, @@ -1535,11 +1500,7 @@ Value *llvm::emitStrNCpy(Value *Dst, Value *Src, Value *Len, IRBuilderBase &B, Type *I8Ptr = B.getInt8PtrTy(); Type *SizeTTy = getSizeTTy(B, TLI); return emitLibCall(LibFunc_strncpy, I8Ptr, {I8Ptr, I8Ptr, SizeTTy}, -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY {Dst, Src, Len}, B, TLI); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - {castToCStr(Dst, B), castToCStr(Src, B), Len}, B, TLI); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY } Value *llvm::emitStpNCpy(Value *Dst, Value *Src, Value *Len, IRBuilderBase &B, @@ -1547,11 +1508,7 @@ Value *llvm::emitStpNCpy(Value *Dst, Value *Src, Value *Len, IRBuilderBase &B, Type *I8Ptr = B.getInt8PtrTy(); Type *SizeTTy = getSizeTTy(B, TLI); return emitLibCall(LibFunc_stpncpy, I8Ptr, {I8Ptr, I8Ptr, SizeTTy}, -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY {Dst, Src, Len}, B, TLI); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - {castToCStr(Dst, B), castToCStr(Src, B), Len}, B, TLI); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY } Value *llvm::emitMemCpyChk(Value *Dst, Value *Src, Value *Len, Value *ObjSize, @@ -1566,13 +1523,9 @@ Value *llvm::emitMemCpyChk(Value *Dst, Value *Src, Value *Len, Value *ObjSize, Attribute::NoUnwind); Type *I8Ptr = B.getInt8PtrTy(); Type *SizeTTy = getSizeTTy(B, TLI); - FunctionCallee MemCpy = getOrInsertLibFunc(M, *TLI, LibFunc_memcpy_chk, - AttributeList::get(M->getContext(), AS), I8Ptr, - I8Ptr, I8Ptr, SizeTTy, SizeTTy); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Dst = castToCStr(Dst, B); - Src = castToCStr(Src, B); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY + FunctionCallee MemCpy = getOrInsertLibFunc( + M, *TLI, LibFunc_memcpy_chk, AttributeList::get(M->getContext(), AS), + I8Ptr, I8Ptr, I8Ptr, SizeTTy, SizeTTy); CallInst *CI = B.CreateCall(MemCpy, {Dst, Src, Len, ObjSize}); if (const Function *F = dyn_cast(MemCpy.getCallee()->stripPointerCasts())) @@ -1594,13 +1547,8 @@ Value *llvm::emitMemChr(Value *Ptr, Value *Val, Value *Len, IRBuilderBase &B, Type *I8Ptr = B.getInt8PtrTy(); Type *IntTy = getIntTy(B, TLI); Type *SizeTTy = getSizeTTy(B, TLI); - return emitLibCall(LibFunc_memchr, I8Ptr, - {I8Ptr, IntTy, SizeTTy}, -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY + return emitLibCall(LibFunc_memchr, I8Ptr, {I8Ptr, IntTy, SizeTTy}, {Ptr, Val, Len}, B, TLI); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - {castToCStr(Ptr, B), Val, Len}, B, TLI); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY } Value *llvm::emitMemRChr(Value *Ptr, Value *Val, Value *Len, IRBuilderBase &B, @@ -1608,13 +1556,8 @@ Value *llvm::emitMemRChr(Value *Ptr, Value *Val, Value *Len, IRBuilderBase &B, Type *I8Ptr = B.getInt8PtrTy(); Type *IntTy = getIntTy(B, TLI); Type *SizeTTy = getSizeTTy(B, TLI); - return emitLibCall(LibFunc_memrchr, I8Ptr, - {I8Ptr, IntTy, SizeTTy}, -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY + return emitLibCall(LibFunc_memrchr, I8Ptr, {I8Ptr, IntTy, SizeTTy}, {Ptr, Val, Len}, B, TLI); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - {castToCStr(Ptr, B), Val, Len}, B, TLI); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY } Value *llvm::emitMemCmp(Value *Ptr1, Value *Ptr2, Value *Len, IRBuilderBase &B, @@ -1622,13 +1565,8 @@ Value *llvm::emitMemCmp(Value *Ptr1, Value *Ptr2, Value *Len, IRBuilderBase &B, Type *I8Ptr = B.getInt8PtrTy(); Type *IntTy = getIntTy(B, TLI); Type *SizeTTy = getSizeTTy(B, TLI); - return emitLibCall(LibFunc_memcmp, IntTy, - {I8Ptr, I8Ptr, SizeTTy}, -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY + return emitLibCall(LibFunc_memcmp, IntTy, {I8Ptr, I8Ptr, SizeTTy}, {Ptr1, Ptr2, Len}, B, TLI); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - {castToCStr(Ptr1, B), castToCStr(Ptr2, B), Len}, B, TLI); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY } Value *llvm::emitBCmp(Value *Ptr1, Value *Ptr2, Value *Len, IRBuilderBase &B, @@ -1636,13 +1574,8 @@ Value *llvm::emitBCmp(Value *Ptr1, Value *Ptr2, Value *Len, IRBuilderBase &B, Type *I8Ptr = B.getInt8PtrTy(); Type *IntTy = getIntTy(B, TLI); Type *SizeTTy = getSizeTTy(B, TLI); - return emitLibCall(LibFunc_bcmp, IntTy, - {I8Ptr, I8Ptr, SizeTTy}, -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY + return emitLibCall(LibFunc_bcmp, IntTy, {I8Ptr, I8Ptr, SizeTTy}, {Ptr1, Ptr2, Len}, B, TLI); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - {castToCStr(Ptr1, B), castToCStr(Ptr2, B), Len}, B, TLI); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY } Value *llvm::emitMemCCpy(Value *Ptr1, Value *Ptr2, Value *Val, Value *Len, @@ -1661,11 +1594,7 @@ Value *llvm::emitSNPrintf(Value *Dest, Value *Size, Value *Fmt, Type *I8Ptr = B.getInt8PtrTy(); Type *IntTy = getIntTy(B, TLI); Type *SizeTTy = getSizeTTy(B, TLI); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY SmallVector Args{Dest, Size, Fmt}; -#else //INTEL_SYCL_OPAQUEPOINTER_READY - SmallVector Args{castToCStr(Dest, B), Size, castToCStr(Fmt, B)}; -#endif //INTEL_SYCL_OPAQUEPOINTER_READY llvm::append_range(Args, VariadicArgs); return emitLibCall(LibFunc_snprintf, IntTy, {I8Ptr, SizeTTy, I8Ptr}, @@ -1677,11 +1606,7 @@ Value *llvm::emitSPrintf(Value *Dest, Value *Fmt, const TargetLibraryInfo *TLI) { Type *I8Ptr = B.getInt8PtrTy(); Type *IntTy = getIntTy(B, TLI); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY SmallVector Args{Dest, Fmt}; -#else //INTEL_SYCL_OPAQUEPOINTER_READY - SmallVector Args{castToCStr(Dest, B), castToCStr(Fmt, B)}; -#endif //INTEL_SYCL_OPAQUEPOINTER_READY llvm::append_range(Args, VariadicArgs); return emitLibCall(LibFunc_sprintf, IntTy, {I8Ptr, I8Ptr}, Args, B, TLI, @@ -1691,51 +1616,31 @@ Value *llvm::emitSPrintf(Value *Dest, Value *Fmt, Value *llvm::emitStrCat(Value *Dest, Value *Src, IRBuilderBase &B, const TargetLibraryInfo *TLI) { return emitLibCall(LibFunc_strcat, B.getInt8PtrTy(), - {B.getInt8PtrTy(), B.getInt8PtrTy()}, -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - {Dest, Src}, B, TLI); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - {castToCStr(Dest, B), castToCStr(Src, B)}, B, TLI); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY + {B.getInt8PtrTy(), B.getInt8PtrTy()}, {Dest, Src}, B, TLI); } Value *llvm::emitStrLCpy(Value *Dest, Value *Src, Value *Size, IRBuilderBase &B, const TargetLibraryInfo *TLI) { Type *I8Ptr = B.getInt8PtrTy(); Type *SizeTTy = getSizeTTy(B, TLI); - return emitLibCall(LibFunc_strlcpy, SizeTTy, - {I8Ptr, I8Ptr, SizeTTy}, -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY + return emitLibCall(LibFunc_strlcpy, SizeTTy, {I8Ptr, I8Ptr, SizeTTy}, {Dest, Src, Size}, B, TLI); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - {castToCStr(Dest, B), castToCStr(Src, B), Size}, B, TLI); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY } Value *llvm::emitStrLCat(Value *Dest, Value *Src, Value *Size, IRBuilderBase &B, const TargetLibraryInfo *TLI) { Type *I8Ptr = B.getInt8PtrTy(); Type *SizeTTy = getSizeTTy(B, TLI); - return emitLibCall(LibFunc_strlcat, SizeTTy, - {I8Ptr, I8Ptr, SizeTTy}, -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY + return emitLibCall(LibFunc_strlcat, SizeTTy, {I8Ptr, I8Ptr, SizeTTy}, {Dest, Src, Size}, B, TLI); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - {castToCStr(Dest, B), castToCStr(Src, B), Size}, B, TLI); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY } Value *llvm::emitStrNCat(Value *Dest, Value *Src, Value *Size, IRBuilderBase &B, const TargetLibraryInfo *TLI) { Type *I8Ptr = B.getInt8PtrTy(); Type *SizeTTy = getSizeTTy(B, TLI); - return emitLibCall(LibFunc_strncat, I8Ptr, - {I8Ptr, I8Ptr, SizeTTy}, -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY + return emitLibCall(LibFunc_strncat, I8Ptr, {I8Ptr, I8Ptr, SizeTTy}, {Dest, Src, Size}, B, TLI); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - {castToCStr(Dest, B), castToCStr(Src, B), Size}, B, TLI); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY } Value *llvm::emitVSNPrintf(Value *Dest, Value *Size, Value *Fmt, Value *VAList, @@ -1743,27 +1648,17 @@ Value *llvm::emitVSNPrintf(Value *Dest, Value *Size, Value *Fmt, Value *VAList, Type *I8Ptr = B.getInt8PtrTy(); Type *IntTy = getIntTy(B, TLI); Type *SizeTTy = getSizeTTy(B, TLI); - return emitLibCall( - LibFunc_vsnprintf, IntTy, - {I8Ptr, SizeTTy, I8Ptr, VAList->getType()}, -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - {Dest, Size, Fmt, VAList}, B, TLI); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - {castToCStr(Dest, B), Size, castToCStr(Fmt, B), VAList}, B, TLI); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY + return emitLibCall(LibFunc_vsnprintf, IntTy, + {I8Ptr, SizeTTy, I8Ptr, VAList->getType()}, + {Dest, Size, Fmt, VAList}, B, TLI); } Value *llvm::emitVSPrintf(Value *Dest, Value *Fmt, Value *VAList, IRBuilderBase &B, const TargetLibraryInfo *TLI) { Type *I8Ptr = B.getInt8PtrTy(); Type *IntTy = getIntTy(B, TLI); - return emitLibCall(LibFunc_vsprintf, IntTy, - {I8Ptr, I8Ptr, VAList->getType()}, -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY + return emitLibCall(LibFunc_vsprintf, IntTy, {I8Ptr, I8Ptr, VAList->getType()}, {Dest, Fmt, VAList}, B, TLI); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - {castToCStr(Dest, B), castToCStr(Fmt, B), VAList}, B, TLI); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY } /// Append a suffix to the function name according to the type of 'Op'. @@ -1915,11 +1810,7 @@ Value *llvm::emitPutS(Value *Str, IRBuilderBase &B, FunctionCallee PutS = getOrInsertLibFunc(M, *TLI, LibFunc_puts, IntTy, B.getInt8PtrTy()); inferNonMandatoryLibFuncAttrs(M, PutsName, *TLI); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY CallInst *CI = B.CreateCall(PutS, Str, PutsName); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - CallInst *CI = B.CreateCall(PutS, castToCStr(Str, B), PutsName); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY if (const Function *F = dyn_cast(PutS.getCallee()->stripPointerCasts())) CI->setCallingConv(F->getCallingConv()); @@ -1958,11 +1849,7 @@ Value *llvm::emitFPutS(Value *Str, Value *File, IRBuilderBase &B, B.getInt8PtrTy(), File->getType()); if (File->getType()->isPointerTy()) inferNonMandatoryLibFuncAttrs(M, FPutsName, *TLI); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY CallInst *CI = B.CreateCall(F, {Str, File}, FPutsName); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - CallInst *CI = B.CreateCall(F, {castToCStr(Str, B), File}, FPutsName); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY if (const Function *Fn = dyn_cast(F.getCallee()->stripPointerCasts())) @@ -1985,12 +1872,7 @@ Value *llvm::emitFWrite(Value *Ptr, Value *Size, Value *File, IRBuilderBase &B, if (File->getType()->isPointerTy()) inferNonMandatoryLibFuncAttrs(M, FWriteName, *TLI); CallInst *CI = -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - B.CreateCall(F, {Ptr, Size, -#else //INTEL_SYCL_OPAQUEPOINTER_READY - B.CreateCall(F, {castToCStr(Ptr, B), Size, -#endif //INTEL_SYCL_OPAQUEPOINTER_READY - ConstantInt::get(SizeTTy, 1), File}); + B.CreateCall(F, {Ptr, Size, ConstantInt::get(SizeTTy, 1), File}); if (const Function *Fn = dyn_cast(F.getCallee()->stripPointerCasts())) diff --git a/llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp b/llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp index 3e8b0358e95d4..d2dbfcfd89d16 100644 --- a/llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp +++ b/llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp @@ -35,11 +35,7 @@ static void insertCall(Function &CurFn, StringRef Func, Triple TargetTriple(M.getTargetTriple()); if (TargetTriple.isOSAIX() && Func == "__mcount") { Type *SizeTy = M.getDataLayout().getIntPtrType(C); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Type *SizePtrTy = SizeTy->getPointerTo(); -#else Type *SizePtrTy = PointerType::getUnqual(C); -#endif GlobalVariable *GV = new GlobalVariable(M, SizeTy, /*isConstant=*/false, GlobalValue::InternalLinkage, ConstantInt::get(SizeTy, 0)); diff --git a/llvm/lib/Transforms/Utils/ModuleUtils.cpp b/llvm/lib/Transforms/Utils/ModuleUtils.cpp index 75ed367f7448b..1e243ef74df7f 100644 --- a/llvm/lib/Transforms/Utils/ModuleUtils.cpp +++ b/llvm/lib/Transforms/Utils/ModuleUtils.cpp @@ -393,15 +393,8 @@ bool llvm::lowerGlobalIFuncUsersAsGlobalCtor( LLVMContext &Ctx = M.getContext(); const DataLayout &DL = M.getDataLayout(); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY PointerType *TableEntryTy = PointerType::get(Ctx, DL.getProgramAddressSpace()); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - PointerType *TableEntryTy = - Ctx.supportsTypedPointers() - ? PointerType::get(Type::getInt8Ty(Ctx), DL.getProgramAddressSpace()) - : PointerType::get(Ctx, DL.getProgramAddressSpace()); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY ArrayType *FuncPtrTableTy = ArrayType::get(TableEntryTy, IFuncsToLower.size()); @@ -471,13 +464,7 @@ bool llvm::lowerGlobalIFuncUsersAsGlobalCtor( InitBuilder.CreateRetVoid(); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY PointerType *ConstantDataTy = PointerType::get(Ctx, 0); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - PointerType *ConstantDataTy = Ctx.supportsTypedPointers() - ? PointerType::get(Type::getInt8Ty(Ctx), 0) - : PointerType::get(Ctx, 0); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY // TODO: Is this the right priority? Probably should be before any other // constructors? diff --git a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp index 0cc26ef932f14..1582bc0c0cedc 100644 --- a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp +++ b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp @@ -163,11 +163,7 @@ Value *SCEVExpander::InsertNoopCastOfTo(Value *V, Type *Ty) { "InsertNoopCastOfTo cannot change sizes!"); // inttoptr only works for integral pointers. For non-integral pointers, we -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY // can create a GEP on null with the integral value as index. Note that -#else //INTEL_SYCL_OPAQUEPOINTER_READY - // can create a GEP on i8* null with the integral value as index. Note that -#endif //INTEL_SYCL_OPAQUEPOINTER_READY // it is safe to use GEP of null instead of inttoptr here, because only // expressions already based on a GEP of null should be converted to pointers // during expansion. @@ -176,15 +172,8 @@ Value *SCEVExpander::InsertNoopCastOfTo(Value *V, Type *Ty) { if (DL.isNonIntegralPointerType(PtrTy)) { assert(DL.getTypeAllocSize(Builder.getInt8Ty()) == 1 && "alloc size of i8 must by 1 byte for the GEP to be correct"); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY - return Builder.CreateGEP( - Builder.getInt8Ty(), Constant::getNullValue(PtrTy), V, "scevgep"); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - auto *Int8PtrTy = Builder.getInt8PtrTy(PtrTy->getAddressSpace()); - auto *GEP = Builder.CreateGEP( - Builder.getInt8Ty(), Constant::getNullValue(Int8PtrTy), V, "scevgep"); - return Builder.CreateBitCast(GEP, Ty); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY + return Builder.CreateGEP(Builder.getInt8Ty(), + Constant::getNullValue(PtrTy), V, "scevgep"); } } // Short-circuit unnecessary bitcasts. @@ -296,144 +285,6 @@ Value *SCEVExpander::InsertBinop(Instruction::BinaryOps Opcode, return BO; } -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY -/// FactorOutConstant - Test if S is divisible by Factor, using signed -/// division. If so, update S with Factor divided out and return true. -/// S need not be evenly divisible if a reasonable remainder can be -/// computed. -static bool FactorOutConstant(const SCEV *&S, const SCEV *&Remainder, - const SCEV *Factor, ScalarEvolution &SE, - const DataLayout &DL) { - // Everything is divisible by one. - if (Factor->isOne()) - return true; - - // x/x == 1. - if (S == Factor) { - S = SE.getConstant(S->getType(), 1); - return true; - } - - // For a Constant, check for a multiple of the given factor. - if (const SCEVConstant *C = dyn_cast(S)) { - // 0/x == 0. - if (C->isZero()) - return true; - // Check for divisibility. - if (const SCEVConstant *FC = dyn_cast(Factor)) { - ConstantInt *CI = - ConstantInt::get(SE.getContext(), C->getAPInt().sdiv(FC->getAPInt())); - // If the quotient is zero and the remainder is non-zero, reject - // the value at this scale. It will be considered for subsequent - // smaller scales. - if (!CI->isZero()) { - const SCEV *Div = SE.getConstant(CI); - S = Div; - Remainder = SE.getAddExpr( - Remainder, SE.getConstant(C->getAPInt().srem(FC->getAPInt()))); - return true; - } - } - } - - // In a Mul, check if there is a constant operand which is a multiple - // of the given factor. - if (const SCEVMulExpr *M = dyn_cast(S)) { - // Size is known, check if there is a constant operand which is a multiple - // of the given factor. If so, we can factor it. - if (const SCEVConstant *FC = dyn_cast(Factor)) - if (const SCEVConstant *C = dyn_cast(M->getOperand(0))) - if (!C->getAPInt().srem(FC->getAPInt())) { - SmallVector NewMulOps(M->operands()); - NewMulOps[0] = SE.getConstant(C->getAPInt().sdiv(FC->getAPInt())); - S = SE.getMulExpr(NewMulOps); - return true; - } - } - - // In an AddRec, check if both start and step are divisible. - if (const SCEVAddRecExpr *A = dyn_cast(S)) { - const SCEV *Step = A->getStepRecurrence(SE); - const SCEV *StepRem = SE.getConstant(Step->getType(), 0); - if (!FactorOutConstant(Step, StepRem, Factor, SE, DL)) - return false; - if (!StepRem->isZero()) - return false; - const SCEV *Start = A->getStart(); - if (!FactorOutConstant(Start, Remainder, Factor, SE, DL)) - return false; - S = SE.getAddRecExpr(Start, Step, A->getLoop(), - A->getNoWrapFlags(SCEV::FlagNW)); - return true; - } - - return false; -} - -/// SimplifyAddOperands - Sort and simplify a list of add operands. NumAddRecs -/// is the number of SCEVAddRecExprs present, which are kept at the end of -/// the list. -/// -static void SimplifyAddOperands(SmallVectorImpl &Ops, - Type *Ty, - ScalarEvolution &SE) { - unsigned NumAddRecs = 0; - for (unsigned i = Ops.size(); i > 0 && isa(Ops[i-1]); --i) - ++NumAddRecs; - // Group Ops into non-addrecs and addrecs. - SmallVector NoAddRecs(Ops.begin(), Ops.end() - NumAddRecs); - SmallVector AddRecs(Ops.end() - NumAddRecs, Ops.end()); - // Let ScalarEvolution sort and simplify the non-addrecs list. - const SCEV *Sum = NoAddRecs.empty() ? - SE.getConstant(Ty, 0) : - SE.getAddExpr(NoAddRecs); - // If it returned an add, use the operands. Otherwise it simplified - // the sum into a single value, so just use that. - Ops.clear(); - if (const SCEVAddExpr *Add = dyn_cast(Sum)) - append_range(Ops, Add->operands()); - else if (!Sum->isZero()) - Ops.push_back(Sum); - // Then append the addrecs. - Ops.append(AddRecs.begin(), AddRecs.end()); -} - -/// SplitAddRecs - Flatten a list of add operands, moving addrec start values -/// out to the top level. For example, convert {a + b,+,c} to a, b, {0,+,d}. -/// This helps expose more opportunities for folding parts of the expressions -/// into GEP indices. -/// -static void SplitAddRecs(SmallVectorImpl &Ops, - Type *Ty, - ScalarEvolution &SE) { - // Find the addrecs. - SmallVector AddRecs; - for (unsigned i = 0, e = Ops.size(); i != e; ++i) - while (const SCEVAddRecExpr *A = dyn_cast(Ops[i])) { - const SCEV *Start = A->getStart(); - if (Start->isZero()) break; - const SCEV *Zero = SE.getConstant(Ty, 0); - AddRecs.push_back(SE.getAddRecExpr(Zero, - A->getStepRecurrence(SE), - A->getLoop(), - A->getNoWrapFlags(SCEV::FlagNW))); - if (const SCEVAddExpr *Add = dyn_cast(Start)) { - Ops[i] = Zero; - append_range(Ops, Add->operands()); - e += Add->getNumOperands(); - } else { - Ops[i] = Start; - } - } - if (!AddRecs.empty()) { - // Add the addrecs onto the end of the list. - Ops.append(AddRecs.begin(), AddRecs.end()); - // Resort the operand list, moving any constants to the front. - SimplifyAddOperands(Ops, Ty, SE); - } -} - -#endif //INTEL_SYCL_OPAQUEPOINTER_READY /// expandAddToGEP - Expand an addition expression with a pointer type into /// a GEP instead of using ptrtoint+arithmetic+inttoptr. This helps /// BasicAliasAnalysis and other passes analyze the result. See the rules @@ -461,135 +312,17 @@ static void SplitAddRecs(SmallVectorImpl &Ops, /// loop-invariant portions of expressions, after considering what /// can be folded using target addressing modes. /// -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Value *SCEVExpander::expandAddToGEP(const SCEV *Offset, Type *Ty, Value *V) { assert(!isa(V) || SE.DT.dominates(cast(V), &*Builder.GetInsertPoint())); -#else //INTEL_SYCL_OPAQUEPOINTER_READY -Value *SCEVExpander::expandAddToGEP(const SCEV *const *op_begin, - const SCEV *const *op_end, - PointerType *PTy, - Type *Ty, - Value *V) { - SmallVector GepIndices; - SmallVector Ops(op_begin, op_end); - bool AnyNonZeroIndices = false; - - // Split AddRecs up into parts as either of the parts may be usable - // without the other. - SplitAddRecs(Ops, Ty, SE); - - Type *IntIdxTy = DL.getIndexType(PTy); - - // For opaque pointers, always generate i8 GEP. - if (!PTy->isOpaque()) { - // Descend down the pointer's type and attempt to convert the other - // operands into GEP indices, at each level. The first index in a GEP - // indexes into the array implied by the pointer operand; the rest of - // the indices index into the element or field type selected by the - // preceding index. - Type *ElTy = PTy->getNonOpaquePointerElementType(); - for (;;) { - // If the scale size is not 0, attempt to factor out a scale for - // array indexing. - SmallVector ScaledOps; - if (ElTy->isSized()) { - const SCEV *ElSize = SE.getSizeOfExpr(IntIdxTy, ElTy); - if (!ElSize->isZero()) { - SmallVector NewOps; - for (const SCEV *Op : Ops) { - const SCEV *Remainder = SE.getConstant(Ty, 0); - if (FactorOutConstant(Op, Remainder, ElSize, SE, DL)) { - // Op now has ElSize factored out. - ScaledOps.push_back(Op); - if (!Remainder->isZero()) - NewOps.push_back(Remainder); - AnyNonZeroIndices = true; - } else { - // The operand was not divisible, so add it to the list of - // operands we'll scan next iteration. - NewOps.push_back(Op); - } - } - // If we made any changes, update Ops. - if (!ScaledOps.empty()) { - Ops = NewOps; - SimplifyAddOperands(Ops, Ty, SE); - } - } - } -#endif //INTEL_SYCL_OPAQUEPOINTER_READY -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Value *Idx = expandCodeForImpl(Offset, Ty); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - // Record the scaled array index for this level of the type. If - // we didn't find any operands that could be factored, tentatively - // assume that element zero was selected (since the zero offset - // would obviously be folded away). - Value *Scaled = - ScaledOps.empty() - ? Constant::getNullValue(Ty) - : expandCodeForImpl(SE.getAddExpr(ScaledOps), Ty); - GepIndices.push_back(Scaled); - - // Collect struct field index operands. - while (StructType *STy = dyn_cast(ElTy)) { - bool FoundFieldNo = false; - // An empty struct has no fields. - if (STy->getNumElements() == 0) break; - // Field offsets are known. See if a constant offset falls within any of - // the struct fields. - if (Ops.empty()) - break; - assert( - !STy->containsScalableVectorType() && - "GEPs are not supported on structures containing scalable vectors"); - if (const SCEVConstant *C = dyn_cast(Ops[0])) - if (SE.getTypeSizeInBits(C->getType()) <= 64) { - const StructLayout &SL = *DL.getStructLayout(STy); - uint64_t FullOffset = C->getValue()->getZExtValue(); - if (FullOffset < SL.getSizeInBytes()) { - unsigned ElIdx = SL.getElementContainingOffset(FullOffset); - GepIndices.push_back( - ConstantInt::get(Type::getInt32Ty(Ty->getContext()), ElIdx)); - ElTy = STy->getTypeAtIndex(ElIdx); - Ops[0] = - SE.getConstant(Ty, FullOffset - SL.getElementOffset(ElIdx)); - AnyNonZeroIndices = true; - FoundFieldNo = true; - } - } - // If no struct field offsets were found, tentatively assume that - // field zero was selected (since the zero offset would obviously - // be folded away). - if (!FoundFieldNo) { - ElTy = STy->getTypeAtIndex(0u); - GepIndices.push_back( - Constant::getNullValue(Type::getInt32Ty(Ty->getContext()))); - } - } -#endif //INTEL_SYCL_OPAQUEPOINTER_READY -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY // Fold a GEP with constant operands. if (Constant *CLHS = dyn_cast(V)) if (Constant *CRHS = dyn_cast(Idx)) return Builder.CreateGEP(Builder.getInt8Ty(), CLHS, CRHS); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - if (ArrayType *ATy = dyn_cast(ElTy)) - ElTy = ATy->getElementType(); - else - // FIXME: Handle VectorType. - // E.g., If ElTy is scalable vector, then ElSize is not a compile-time - // constant, therefore can not be factored out. The generated IR is less - // ideal with base 'V' cast to i8* and do ugly getelementptr over that. - break; - } - } -#endif //INTEL_SYCL_OPAQUEPOINTER_READY -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY // Do a quick scan to see if we have this GEP nearby. If so, reuse it. unsigned ScanLimit = 6; BasicBlock::iterator BlockBegin = Builder.GetInsertBlock()->begin(); @@ -607,130 +340,27 @@ Value *SCEVExpander::expandAddToGEP(const SCEV *const *op_begin, cast(&*IP)->getSourceElementType() == Type::getInt8Ty(Ty->getContext())) return &*IP; - if (IP == BlockBegin) break; -#else //INTEL_SYCL_OPAQUEPOINTER_READY - // If none of the operands were convertible to proper GEP indices, cast - // the base to i8* and do an ugly getelementptr with that. It's still - // better than ptrtoint+arithmetic+inttoptr at least. - if (!AnyNonZeroIndices) { - // Cast the base to i8*. - if (!PTy->isOpaque()) - V = InsertNoopCastOfTo(V, - Type::getInt8PtrTy(Ty->getContext(), PTy->getAddressSpace())); - - assert(!isa(V) || - SE.DT.dominates(cast(V), &*Builder.GetInsertPoint())); - - // Expand the operands for a plain byte offset. - Value *Idx = expandCodeForImpl(SE.getAddExpr(Ops), Ty); - - // Fold a GEP with constant operands. - if (Constant *CLHS = dyn_cast(V)) - if (Constant *CRHS = dyn_cast(Idx)) - return Builder.CreateGEP(Builder.getInt8Ty(), CLHS, CRHS); - - // Do a quick scan to see if we have this GEP nearby. If so, reuse it. - unsigned ScanLimit = 6; - BasicBlock::iterator BlockBegin = Builder.GetInsertBlock()->begin(); - // Scanning starts from the last instruction before the insertion point. - BasicBlock::iterator IP = Builder.GetInsertPoint(); - if (IP != BlockBegin) { - --IP; - for (; ScanLimit; --IP, --ScanLimit) { - // Don't count dbg.value against the ScanLimit, to avoid perturbing the - // generated code. - if (isa(IP)) - ScanLimit++; - if (IP->getOpcode() == Instruction::GetElementPtr && - IP->getOperand(0) == V && IP->getOperand(1) == Idx && - cast(&*IP)->getSourceElementType() == - Type::getInt8Ty(Ty->getContext())) - return &*IP; - if (IP == BlockBegin) break; - } -#endif //INTEL_SYCL_OPAQUEPOINTER_READY - } -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - - // Save the original insertion point so we can restore it when we're done. - SCEVInsertPointGuard Guard(Builder, this); - - // Move the insertion point out of as many loops as we can. - while (const Loop *L = SE.LI.getLoopFor(Builder.GetInsertBlock())) { - if (!L->isLoopInvariant(V) || !L->isLoopInvariant(Idx)) break; - BasicBlock *Preheader = L->getLoopPreheader(); - if (!Preheader) break; - - // Ok, move up a level. - Builder.SetInsertPoint(Preheader->getTerminator()); + if (IP == BlockBegin) + break; } - - // Emit a GEP. - return Builder.CreateGEP(Builder.getInt8Ty(), V, Idx, "scevgep"); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY } -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY // Save the original insertion point so we can restore it when we're done. SCEVInsertPointGuard Guard(Builder, this); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - { - SCEVInsertPointGuard Guard(Builder, this); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY // Move the insertion point out of as many loops as we can. while (const Loop *L = SE.LI.getLoopFor(Builder.GetInsertBlock())) { if (!L->isLoopInvariant(V) || !L->isLoopInvariant(Idx)) break; BasicBlock *Preheader = L->getLoopPreheader(); - if (!Preheader) break; -#else //INTEL_SYCL_OPAQUEPOINTER_READY - // Move the insertion point out of as many loops as we can. - while (const Loop *L = SE.LI.getLoopFor(Builder.GetInsertBlock())) { - if (!L->isLoopInvariant(V)) break; -#endif //INTEL_SYCL_OPAQUEPOINTER_READY + if (!Preheader) + break; -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY // Ok, move up a level. Builder.SetInsertPoint(Preheader->getTerminator()); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - bool AnyIndexNotLoopInvariant = any_of( - GepIndices, [L](Value *Op) { return !L->isLoopInvariant(Op); }); - - if (AnyIndexNotLoopInvariant) - break; - - BasicBlock *Preheader = L->getLoopPreheader(); - if (!Preheader) break; - - // Ok, move up a level. - Builder.SetInsertPoint(Preheader->getTerminator()); - } - - // Insert a pretty getelementptr. Note that this GEP is not marked inbounds, - // because ScalarEvolution may have changed the address arithmetic to - // compute a value which is beyond the end of the allocated object. - Value *Casted = V; - if (V->getType() != PTy) - Casted = InsertNoopCastOfTo(Casted, PTy); - Value *GEP = Builder.CreateGEP(PTy->getNonOpaquePointerElementType(), - Casted, GepIndices, "scevgep"); - Ops.push_back(SE.getUnknown(GEP)); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY } -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY // Emit a GEP. return Builder.CreateGEP(Builder.getInt8Ty(), V, Idx, "scevgep"); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - return expand(SE.getAddExpr(Ops)); -} - -Value *SCEVExpander::expandAddToGEP(const SCEV *Op, PointerType *PTy, Type *Ty, - Value *V) { - const SCEV *const Ops[1] = {Op}; - return expandAddToGEP(Ops, Ops + 1, PTy, Ty, V); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY } /// PickMostRelevantLoop - Given two loops pick the one that's most relevant for @@ -856,11 +486,7 @@ Value *SCEVExpander::visitAddExpr(const SCEVAddExpr *S) { } assert(!Op->getType()->isPointerTy() && "Only first op can be pointer"); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY if (isa(Sum->getType())) { -#else //INTEL_SYCL_OPAQUEPOINTER_READY - if (PointerType *PTy = dyn_cast(Sum->getType())) { -#endif //INTEL_SYCL_OPAQUEPOINTER_READY // The running sum expression is a pointer. Try to form a getelementptr // at this level with that as the base. SmallVector NewOps; @@ -873,11 +499,7 @@ Value *SCEVExpander::visitAddExpr(const SCEVAddExpr *S) { X = SE.getSCEV(U->getValue()); NewOps.push_back(X); } -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Sum = expandAddToGEP(SE.getAddExpr(NewOps), Ty, Sum); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - Sum = expandAddToGEP(NewOps.begin(), NewOps.end(), PTy, Ty, Sum); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY } else if (Op->isNonConstantNegative()) { // Instead of doing a negate and add, just do a subtract. Value *W = expandCodeForImpl(SE.getNegativeSCEV(Op), Ty); @@ -1187,19 +809,7 @@ Value *SCEVExpander::expandIVInc(PHINode *PN, Value *StepV, const Loop *L, Value *IncV; // If the PHI is a pointer, use a GEP, otherwise use an add or sub. if (ExpandTy->isPointerTy()) { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY IncV = expandAddToGEP(SE.getSCEV(StepV), IntTy, PN); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - PointerType *GEPPtrTy = cast(ExpandTy); - // If the step isn't constant, don't use an implicitly scaled GEP, because - // that would require a multiply inside the loop. - if (!isa(StepV)) - GEPPtrTy = PointerType::get(Type::getInt1Ty(SE.getContext()), - GEPPtrTy->getAddressSpace()); - IncV = expandAddToGEP(SE.getSCEV(StepV), GEPPtrTy, IntTy, PN); - if (IncV->getType() != PN->getType()) - IncV = Builder.CreateBitCast(IncV, PN->getType()); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY } else { IncV = useSubtract ? Builder.CreateSub(PN, StepV, Twine(IVName) + ".iv.next") : @@ -1599,24 +1209,12 @@ Value *SCEVExpander::expandAddRecExprLiterally(const SCEVAddRecExpr *S) { // Re-apply any non-loop-dominating offset. if (PostLoopOffset) { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY if (isa(ExpandTy)) { -#else //INTEL_SYCL_OPAQUEPOINTER_READY - if (PointerType *PTy = dyn_cast(ExpandTy)) { -#endif //INTEL_SYCL_OPAQUEPOINTER_READY if (Result->getType()->isIntegerTy()) { Value *Base = expandCodeForImpl(PostLoopOffset, ExpandTy); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Result = expandAddToGEP(SE.getUnknown(Result), IntTy, Base); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - Result = expandAddToGEP(SE.getUnknown(Result), PTy, IntTy, Base); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY } else { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Result = expandAddToGEP(PostLoopOffset, IntTy, Result); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - Result = expandAddToGEP(PostLoopOffset, PTy, IntTy, Result); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY } } else { Result = InsertNoopCastOfTo(Result, IntTy); @@ -1670,18 +1268,9 @@ Value *SCEVExpander::visitAddRecExpr(const SCEVAddRecExpr *S) { // {X,+,F} --> X + {0,+,F} if (!S->getStart()->isZero()) { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY if (isa(S->getType())) { -#else //INTEL_SYCL_OPAQUEPOINTER_READY - if (PointerType *PTy = dyn_cast(S->getType())) { -#endif //INTEL_SYCL_OPAQUEPOINTER_READY Value *StartV = expand(SE.getPointerBase(S)); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY return expandAddToGEP(SE.removePointerBase(S), Ty, StartV); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - assert(StartV->getType() == PTy && "Pointer type mismatch for GEP!"); - return expandAddToGEP(SE.removePointerBase(S), PTy, Ty, StartV); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY } SmallVector NewOps(S->operands()); diff --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp index 07b79382e92f3..d7f45d637e244 100644 --- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp @@ -1186,11 +1186,7 @@ Value *LibCallSimplifier::optimizeStrStr(CallInst *CI, IRBuilderBase &B) { return Constant::getNullValue(CI->getType()); // strstr("abcd", "bc") -> gep((char*)"abcd", 1) -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Value *Result = CI->getArgOperand(0); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - Value *Result = castToCStr(CI->getArgOperand(0), B); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY Result = B.CreateConstInBoundsGEP1_64(B.getInt8Ty(), Result, Offset, "strstr"); return B.CreateBitCast(Result, CI->getType()); @@ -1538,19 +1534,10 @@ static Value *optimizeMemCmpConstantSize(CallInst *CI, Value *LHS, Value *RHS, // memcmp(S1,S2,1) -> *(unsigned char*)LHS - *(unsigned char*)RHS if (Len == 1) { -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Value *LHSV = B.CreateZExt(B.CreateLoad(B.getInt8Ty(), LHS, "lhsc"), CI->getType(), "lhsv"); Value *RHSV = B.CreateZExt(B.CreateLoad(B.getInt8Ty(), RHS, "rhsc"), CI->getType(), "rhsv"); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - Value *LHSV = - B.CreateZExt(B.CreateLoad(B.getInt8Ty(), castToCStr(LHS, B), "lhsc"), - CI->getType(), "lhsv"); - Value *RHSV = - B.CreateZExt(B.CreateLoad(B.getInt8Ty(), castToCStr(RHS, B), "rhsc"), - CI->getType(), "rhsv"); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY return B.CreateSub(LHSV, RHSV, "chardiff"); } @@ -3089,11 +3076,7 @@ Value *LibCallSimplifier::optimizeSPrintFString(CallInst *CI, if (!CI->getArgOperand(2)->getType()->isIntegerTy()) return nullptr; Value *V = B.CreateTrunc(CI->getArgOperand(2), B.getInt8Ty(), "char"); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Value *Ptr = Dest; -#else //INTEL_SYCL_OPAQUEPOINTER_READY - Value *Ptr = castToCStr(Dest, B); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY B.CreateStore(V, Ptr); Ptr = B.CreateInBoundsGEP(B.getInt8Ty(), Ptr, B.getInt32(1), "nul"); B.CreateStore(B.getInt8(0), Ptr); @@ -3288,11 +3271,7 @@ Value *LibCallSimplifier::optimizeSnPrintFString(CallInst *CI, if (!CI->getArgOperand(3)->getType()->isIntegerTy()) return nullptr; Value *V = B.CreateTrunc(CI->getArgOperand(3), B.getInt8Ty(), "char"); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Value *Ptr = DstArg; -#else //INTEL_SYCL_OPAQUEPOINTER_READY - Value *Ptr = castToCStr(DstArg, B); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY B.CreateStore(V, Ptr); Ptr = B.CreateInBoundsGEP(B.getInt8Ty(), Ptr, B.getInt32(1), "nul"); B.CreateStore(B.getInt8(0), Ptr); @@ -3428,12 +3407,7 @@ Value *LibCallSimplifier::optimizeFWrite(CallInst *CI, IRBuilderBase &B) { // If this is writing one byte, turn it into fputc. // This optimisation is only valid, if the return value is unused. if (Bytes == 1 && CI->use_empty()) { // fwrite(S,1,1,F) -> fputc(S[0],F) -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Value *Char = B.CreateLoad(B.getInt8Ty(), CI->getArgOperand(0), "char"); -#else //INTEL_SYCL_OPAQUEPOINTER_READY - Value *Char = B.CreateLoad(B.getInt8Ty(), - castToCStr(CI->getArgOperand(0), B), "char"); -#endif //INTEL_SYCL_OPAQUEPOINTER_READY Type *IntTy = B.getIntNTy(TLI->getIntSize()); Value *Cast = B.CreateIntCast(Char, IntTy, /*isSigned*/ true, "chari"); Value *NewCI = emitFPutC(Cast, CI->getArgOperand(3), B, TLI); diff --git a/llvm/test/tools/llvm-pdbutil/Inputs/TypeServerTest.cpp b/llvm/test/tools/llvm-pdbutil/Inputs/TypeServerTest.cpp index 140881db38cd0..6a773a6e6cfc8 100644 --- a/llvm/test/tools/llvm-pdbutil/Inputs/TypeServerTest.cpp +++ b/llvm/test/tools/llvm-pdbutil/Inputs/TypeServerTest.cpp @@ -1,6 +1,6 @@ -// Compile with "cl /c /Zi TypeServerTest.cpp /FdTypeServerTest.pdb" - -int main(void) -{ - return 0; -} +// Compile with "cl /c /Zi TypeServerTest.cpp /FdTypeServerTest.pdb" + +int main(void) +{ + return 0; +} diff --git a/llvm/tools/llvm-nm/llvm-nm.cpp b/llvm/tools/llvm-nm/llvm-nm.cpp index a4b0da5abe2a2..4aa585291bd78 100644 --- a/llvm/tools/llvm-nm/llvm-nm.cpp +++ b/llvm/tools/llvm-nm/llvm-nm.cpp @@ -2277,12 +2277,6 @@ static std::vector dumpSymbolNamesFromFile(StringRef Filename) { return SymbolList; LLVMContext Context; -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - // Always enable opaque pointers, to handle archives with mixed typed and - // opaque pointer bitcode files gracefully. As we're only reading symbols, - // the used pointer types don't matter. - Context.setOpaquePointers(true); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY LLVMContext *ContextPtr = NoLLVMBitcode ? nullptr : &Context; Expected> BinaryOrErr = createBinary(BufferOrErr.get()->getMemBufferRef(), ContextPtr); diff --git a/llvm/tools/llvm-stress/llvm-stress.cpp b/llvm/tools/llvm-stress/llvm-stress.cpp index bab0641cd09b6..4b0c22a5e5c54 100644 --- a/llvm/tools/llvm-stress/llvm-stress.cpp +++ b/llvm/tools/llvm-stress/llvm-stress.cpp @@ -131,20 +131,9 @@ class Random { Function *GenEmptyFunction(Module *M) { // Define a few arguments LLVMContext &Context = M->getContext(); - Type* ArgsTy[] = { -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Type::getInt8PtrTy(Context), - Type::getInt32PtrTy(Context), - Type::getInt64PtrTy(Context), -#else - PointerType::get(Context, 0), - PointerType::get(Context, 0), - PointerType::get(Context, 0), -#endif - Type::getInt32Ty(Context), - Type::getInt64Ty(Context), - Type::getInt8Ty(Context) - }; + Type *ArgsTy[] = {PointerType::get(Context, 0), PointerType::get(Context, 0), + PointerType::get(Context, 0), Type::getInt32Ty(Context), + Type::getInt64Ty(Context), Type::getInt8Ty(Context)}; auto *FuncTy = FunctionType::get(Type::getVoidTy(Context), ArgsTy, false); // Pick a unique name to describe the input parameters @@ -347,13 +336,7 @@ struct LoadModifier: public Modifier { void Act() override { // Try to use predefined pointers. If non-exist, use undef pointer value; Value *Ptr = getRandomPointerValue(); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Type *Ty = pickType(); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - Type *Ty = Ptr->getType()->isOpaquePointerTy() - ? pickType() - : Ptr->getType()->getNonOpaquePointerElementType(); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY Value *V = new LoadInst(Ty, Ptr, "L", BB->getTerminator()); PT->push_back(V); } @@ -366,13 +349,7 @@ struct StoreModifier: public Modifier { void Act() override { // Try to use predefined pointers. If non-exist, use undef pointer value; Value *Ptr = getRandomPointerValue(); -#ifdef INTEL_SYCL_OPAQUEPOINTER_READY Type *ValTy = pickType(); -#else // INTEL_SYCL_OPAQUEPOINTER_READY - Type *ValTy = Ptr->getType()->isOpaquePointerTy() - ? pickType() - : Ptr->getType()->getNonOpaquePointerElementType(); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY // Do not store vectors of i1s because they are unsupported // by the codegen. diff --git a/llvm/unittests/Analysis/AliasAnalysisTest.cpp b/llvm/unittests/Analysis/AliasAnalysisTest.cpp index 2938c0db84ea5..cb8a412f329a6 100644 --- a/llvm/unittests/Analysis/AliasAnalysisTest.cpp +++ b/llvm/unittests/Analysis/AliasAnalysisTest.cpp @@ -169,11 +169,7 @@ TEST_F(AliasAnalysisTest, getModRefInfo) { auto *F = Function::Create(FTy, Function::ExternalLinkage, "f", M); auto *BB = BasicBlock::Create(C, "entry", F); auto IntType = Type::getInt32Ty(C); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - auto PtrType = Type::getInt32PtrTy(C); -#else auto PtrType = PointerType::get(C, 0); -#endif auto *Value = ConstantInt::get(IntType, 42); auto *Addr = ConstantPointerNull::get(PtrType); auto Alignment = Align(IntType->getBitWidth() / 8); diff --git a/llvm/unittests/Analysis/AssumeBundleQueriesTest.cpp b/llvm/unittests/Analysis/AssumeBundleQueriesTest.cpp index e9ce516839f07..a8a05e0caeee5 100644 --- a/llvm/unittests/Analysis/AssumeBundleQueriesTest.cpp +++ b/llvm/unittests/Analysis/AssumeBundleQueriesTest.cpp @@ -421,11 +421,7 @@ static void RunRandTest(uint64_t Seed, int Size, int MinCount, int MaxCount, std::vector TypeArgs; for (int i = 0; i < (Size * 2); i++) -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - TypeArgs.push_back(Type::getInt32PtrTy(C)); -#else TypeArgs.push_back(PointerType::getUnqual(C)); -#endif FunctionType *FuncType = FunctionType::get(Type::getVoidTy(C), TypeArgs, false); diff --git a/llvm/unittests/Analysis/PhiValuesTest.cpp b/llvm/unittests/Analysis/PhiValuesTest.cpp index 33efb39b57321..11a3890aff456 100644 --- a/llvm/unittests/Analysis/PhiValuesTest.cpp +++ b/llvm/unittests/Analysis/PhiValuesTest.cpp @@ -24,11 +24,7 @@ TEST(PhiValuesTest, SimplePhi) { Type *VoidTy = Type::getVoidTy(C); Type *I1Ty = Type::getInt1Ty(C); Type *I32Ty = Type::getInt32Ty(C); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Type *I32PtrTy = Type::getInt32PtrTy(C); -#else Type *PtrTy = PointerType::get(C, 0); -#endif // Create a function with phis that do not have other phis as incoming values Function *F = Function::Create(FunctionType::get(VoidTy, false), @@ -41,17 +37,10 @@ TEST(PhiValuesTest, SimplePhi) { BranchInst::Create(If, Else, UndefValue::get(I1Ty), Entry); BranchInst::Create(Then, If); BranchInst::Create(Then, Else); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Value *Val1 = new LoadInst(I32Ty, UndefValue::get(I32PtrTy), "val1", Entry); - Value *Val2 = new LoadInst(I32Ty, UndefValue::get(I32PtrTy), "val2", Entry); - Value *Val3 = new LoadInst(I32Ty, UndefValue::get(I32PtrTy), "val3", Entry); - Value *Val4 = new LoadInst(I32Ty, UndefValue::get(I32PtrTy), "val4", Entry); -#else Value *Val1 = new LoadInst(I32Ty, UndefValue::get(PtrTy), "val1", Entry); Value *Val2 = new LoadInst(I32Ty, UndefValue::get(PtrTy), "val2", Entry); Value *Val3 = new LoadInst(I32Ty, UndefValue::get(PtrTy), "val3", Entry); Value *Val4 = new LoadInst(I32Ty, UndefValue::get(PtrTy), "val4", Entry); -#endif PHINode *Phi1 = PHINode::Create(I32Ty, 2, "phi1", Then); Phi1->addIncoming(Val1, If); @@ -101,11 +90,7 @@ TEST(PhiValuesTest, DependentPhi) { Type *VoidTy = Type::getVoidTy(C); Type *I1Ty = Type::getInt1Ty(C); Type *I32Ty = Type::getInt32Ty(C); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Type *I32PtrTy = Type::getInt32PtrTy(C); -#else Type *PtrTy = PointerType::get(C, 0); -#endif // Create a function with a phi that has another phi as an incoming value Function *F = Function::Create(FunctionType::get(VoidTy, false), @@ -125,17 +110,10 @@ TEST(PhiValuesTest, DependentPhi) { BranchInst::Create(End, If2); BranchInst::Create(End, Else2); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Value *Val1 = new LoadInst(I32Ty, UndefValue::get(I32PtrTy), "val1", Entry); - Value *Val2 = new LoadInst(I32Ty, UndefValue::get(I32PtrTy), "val2", Entry); - Value *Val3 = new LoadInst(I32Ty, UndefValue::get(I32PtrTy), "val3", Entry); - Value *Val4 = new LoadInst(I32Ty, UndefValue::get(I32PtrTy), "val4", Entry); -#else Value *Val1 = new LoadInst(I32Ty, UndefValue::get(PtrTy), "val1", Entry); Value *Val2 = new LoadInst(I32Ty, UndefValue::get(PtrTy), "val2", Entry); Value *Val3 = new LoadInst(I32Ty, UndefValue::get(PtrTy), "val3", Entry); Value *Val4 = new LoadInst(I32Ty, UndefValue::get(PtrTy), "val4", Entry); -#endif PHINode *Phi1 = PHINode::Create(I32Ty, 2, "phi1", Then); Phi1->addIncoming(Val1, If1); diff --git a/llvm/unittests/Analysis/SparsePropagation.cpp b/llvm/unittests/Analysis/SparsePropagation.cpp index 69a8ec1a0e0a4..e77eadf067170 100644 --- a/llvm/unittests/Analysis/SparsePropagation.cpp +++ b/llvm/unittests/Analysis/SparsePropagation.cpp @@ -372,11 +372,7 @@ TEST_F(SparsePropagationTest, GlobalVariableOverDefined) { TEST_F(SparsePropagationTest, FunctionDefined) { Function *F = Function::Create(FunctionType::get(Builder.getInt64Ty(), -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - {Type::getInt1PtrTy(Context)}, false), -#else {PointerType::get(Context, 0)}, false), -#endif GlobalValue::InternalLinkage, "f", &M); BasicBlock *If = BasicBlock::Create(Context, "if", F); BasicBlock *Then = BasicBlock::Create(Context, "then", F); @@ -416,11 +412,7 @@ TEST_F(SparsePropagationTest, FunctionDefined) { TEST_F(SparsePropagationTest, FunctionOverDefined) { Function *F = Function::Create(FunctionType::get(Builder.getInt64Ty(), -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - {Type::getInt1PtrTy(Context)}, false), -#else {PointerType::get(Context, 0)}, false), -#endif GlobalValue::InternalLinkage, "f", &M); BasicBlock *If = BasicBlock::Create(Context, "if", F); BasicBlock *Then = BasicBlock::Create(Context, "then", F); diff --git a/llvm/unittests/Analysis/TBAATest.cpp b/llvm/unittests/Analysis/TBAATest.cpp index 27a0d170d303e..b42542e5064e9 100644 --- a/llvm/unittests/Analysis/TBAATest.cpp +++ b/llvm/unittests/Analysis/TBAATest.cpp @@ -36,11 +36,7 @@ static StoreInst *getFunctionWithSingleStore(Module *M, StringRef Name) { auto *F = Function::Create(FTy, Function::ExternalLinkage, Name, M); auto *BB = BasicBlock::Create(C, "entry", F); auto *IntType = Type::getInt32Ty(C); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - auto *PtrType = Type::getInt32PtrTy(C); -#else auto *PtrType = PointerType::get(C, 0); -#endif auto *SI = new StoreInst(ConstantInt::get(IntType, 42), ConstantPointerNull::get(PtrType), BB); ReturnInst::Create(C, nullptr, BB); diff --git a/llvm/unittests/AsmParser/AsmParserTest.cpp b/llvm/unittests/AsmParser/AsmParserTest.cpp index 719d51df6cb4c..9973dc4696fbb 100644 --- a/llvm/unittests/AsmParser/AsmParserTest.cpp +++ b/llvm/unittests/AsmParser/AsmParserTest.cpp @@ -253,11 +253,6 @@ TEST(AsmParserTest, TypeWithSlotMappingParsing) { ASSERT_TRUE(Ty); ASSERT_TRUE(Ty->isPointerTy()); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - PointerType *PT = cast(Ty); - ASSERT_TRUE(PT->isOpaque()); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY - // Check that we reject types with garbage. Ty = parseType("i32 garbage", Error, M, &Mapping); ASSERT_TRUE(!Ty); @@ -373,11 +368,6 @@ TEST(AsmParserTest, TypeAtBeginningWithSlotMappingParsing) { ASSERT_TRUE(Ty->isPointerTy()); ASSERT_TRUE(Read == 3); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - PointerType *PT = cast(Ty); - ASSERT_TRUE(PT->isOpaque()); -#endif // INTEL_SYCL_OPAQUEPOINTER_READY - // Check that we reject types with garbage. Ty = parseTypeAtBeginning("i32 garbage", Read, Error, M, &Mapping); ASSERT_TRUE(Ty); diff --git a/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp b/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp index e9042adf758ec..5870457956b54 100644 --- a/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp +++ b/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp @@ -1125,26 +1125,6 @@ TEST_F(OpenMPIRBuilderTest, ParallelForwardAsPointers) { OpenMPIRBuilder::LocationDescription Loc({Builder.saveIP(), DL}); using InsertPointTy = OpenMPIRBuilder::InsertPointTy; -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Type *I32Ty = Type::getInt32Ty(M->getContext()); - Type *I32PtrTy = Type::getInt32PtrTy(M->getContext()); - Type *StructTy = StructType::get(I32Ty, I32PtrTy); - Type *StructPtrTy = StructTy->getPointerTo(); - Type *VoidTy = Type::getVoidTy(M->getContext()); - FunctionCallee RetI32Func = M->getOrInsertFunction("ret_i32", I32Ty); - FunctionCallee TakeI32Func = - M->getOrInsertFunction("take_i32", VoidTy, I32Ty); - FunctionCallee RetI32PtrFunc = M->getOrInsertFunction("ret_i32ptr", I32PtrTy); - FunctionCallee TakeI32PtrFunc = - M->getOrInsertFunction("take_i32ptr", VoidTy, I32PtrTy); - FunctionCallee RetStructFunc = M->getOrInsertFunction("ret_struct", StructTy); - FunctionCallee TakeStructFunc = - M->getOrInsertFunction("take_struct", VoidTy, StructTy); - FunctionCallee RetStructPtrFunc = - M->getOrInsertFunction("ret_structptr", StructPtrTy); - FunctionCallee TakeStructPtrFunc = - M->getOrInsertFunction("take_structPtr", VoidTy, StructPtrTy); -#else Type *I32Ty = Type::getInt32Ty(M->getContext()); Type *PtrTy = PointerType::get(M->getContext(), 0); Type *StructTy = StructType::get(I32Ty, PtrTy); @@ -1162,7 +1142,6 @@ TEST_F(OpenMPIRBuilderTest, ParallelForwardAsPointers) { M->getOrInsertFunction("ret_structptr", PtrTy); FunctionCallee TakeStructPtrFunc = M->getOrInsertFunction("take_structPtr", VoidTy, PtrTy); -#endif Value *I32Val = Builder.CreateCall(RetI32Func); Value *I32PtrVal = Builder.CreateCall(RetI32PtrFunc); Value *StructVal = Builder.CreateCall(RetStructFunc); @@ -5237,13 +5216,8 @@ TEST_F(OpenMPIRBuilderTest, TargetRegionDevice) { LoadInst *Value = nullptr; StoreInst *TargetStore = nullptr; llvm::SmallVector CapturedArgs = { -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Constant::getNullValue(Type::getInt32PtrTy(Ctx)), - Constant::getNullValue(Type::getInt32PtrTy(Ctx))}; -#else Constant::getNullValue(PointerType::get(Ctx, 0)), Constant::getNullValue(PointerType::get(Ctx, 0))}; -#endif llvm::OpenMPIRBuilder::MapInfosTy CombinedInfos; auto GenMapInfoCB = [&](llvm::OpenMPIRBuilder::InsertPointTy codeGenIP) @@ -5881,17 +5855,10 @@ TEST_F(OpenMPIRBuilderTest, EmitOffloadingArraysArguments) { OpenMPIRBuilder::TargetDataRTArgs RTArgs; OpenMPIRBuilder::TargetDataInfo Info(true, false); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - auto VoidPtrTy = Type::getInt8PtrTy(Builder.getContext()); - auto VoidPtrPtrTy = VoidPtrTy->getPointerTo(0); - auto Int64Ty = Type::getInt64Ty(Builder.getContext()); - auto Int64PtrTy = Type::getInt64PtrTy(Builder.getContext()); -#else auto VoidPtrTy = PointerType::getUnqual(Builder.getContext()); auto VoidPtrPtrTy = PointerType::getUnqual(Builder.getContext()); auto Int64Ty = Type::getInt64Ty(Builder.getContext()); auto Int64PtrTy = PointerType::getUnqual(Builder.getContext()); -#endif auto Array4VoidPtrTy = ArrayType::get(VoidPtrTy, 4); auto Array4Int64PtrTy = ArrayType::get(Int64Ty, 4); diff --git a/llvm/unittests/IR/BasicBlockTest.cpp b/llvm/unittests/IR/BasicBlockTest.cpp index 646b3091a4d7a..3756f227143a5 100644 --- a/llvm/unittests/IR/BasicBlockTest.cpp +++ b/llvm/unittests/IR/BasicBlockTest.cpp @@ -101,11 +101,7 @@ TEST(BasicBlockTest, TestInstructionsWithoutDebug) { LLVMContext Ctx; Module *M = new Module("MyModule", Ctx); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Type *ArgTy1[] = {Type::getInt32PtrTy(Ctx)}; -#else Type *ArgTy1[] = {PointerType::getUnqual(Ctx)}; -#endif FunctionType *FT = FunctionType::get(Type::getVoidTy(Ctx), ArgTy1, false); Argument *V = new Argument(Type::getInt32Ty(Ctx)); Function *F = Function::Create(FT, Function::ExternalLinkage, "", M); diff --git a/llvm/unittests/IR/ConstantsTest.cpp b/llvm/unittests/IR/ConstantsTest.cpp index a914157cc6c6b..e905452f32b36 100644 --- a/llvm/unittests/IR/ConstantsTest.cpp +++ b/llvm/unittests/IR/ConstantsTest.cpp @@ -125,71 +125,6 @@ TEST(ConstantsTest, FP128Test) { EXPECT_TRUE(isa(X)); } -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY -TEST(ConstantsTest, PointerCast) { - LLVMContext C; - Type *Int8PtrTy = Type::getInt8PtrTy(C); - Type *Int32PtrTy = Type::getInt32PtrTy(C); - Type *Int64Ty = Type::getInt64Ty(C); - VectorType *Int8PtrVecTy = FixedVectorType::get(Int8PtrTy, 4); - VectorType *Int32PtrVecTy = FixedVectorType::get(Int32PtrTy, 4); - VectorType *Int64VecTy = FixedVectorType::get(Int64Ty, 4); - VectorType *Int8PtrScalableVecTy = ScalableVectorType::get(Int8PtrTy, 4); - VectorType *Int32PtrScalableVecTy = ScalableVectorType::get(Int32PtrTy, 4); - VectorType *Int64ScalableVecTy = ScalableVectorType::get(Int64Ty, 4); - - // ptrtoint i8* to i64 - EXPECT_EQ( - Constant::getNullValue(Int64Ty), - ConstantExpr::getPointerCast(Constant::getNullValue(Int8PtrTy), Int64Ty)); - - // bitcast i8* to i32* - EXPECT_EQ(Constant::getNullValue(Int32PtrTy), - ConstantExpr::getPointerCast(Constant::getNullValue(Int8PtrTy), - Int32PtrTy)); - - // ptrtoint <4 x i8*> to <4 x i64> - EXPECT_EQ(Constant::getNullValue(Int64VecTy), - ConstantExpr::getPointerCast(Constant::getNullValue(Int8PtrVecTy), - Int64VecTy)); - - // ptrtoint to - EXPECT_EQ( - Constant::getNullValue(Int64ScalableVecTy), - ConstantExpr::getPointerCast(Constant::getNullValue(Int8PtrScalableVecTy), - Int64ScalableVecTy)); - - // bitcast <4 x i8*> to <4 x i32*> - EXPECT_EQ(Constant::getNullValue(Int32PtrVecTy), - ConstantExpr::getPointerCast(Constant::getNullValue(Int8PtrVecTy), - Int32PtrVecTy)); - - // bitcast to - EXPECT_EQ( - Constant::getNullValue(Int32PtrScalableVecTy), - ConstantExpr::getPointerCast(Constant::getNullValue(Int8PtrScalableVecTy), - Int32PtrScalableVecTy)); - - Type *Int32Ptr1Ty = Type::getInt32PtrTy(C, 1); - ConstantInt *K = ConstantInt::get(Type::getInt64Ty(C), 1234); - - // Make sure that addrspacecast of inttoptr is not folded away. - EXPECT_NE(K, ConstantExpr::getAddrSpaceCast( - ConstantExpr::getIntToPtr(K, Int32PtrTy), Int32Ptr1Ty)); - EXPECT_NE(K, ConstantExpr::getAddrSpaceCast( - ConstantExpr::getIntToPtr(K, Int32Ptr1Ty), Int32PtrTy)); - - Constant *NullInt32Ptr0 = Constant::getNullValue(Int32PtrTy); - Constant *NullInt32Ptr1 = Constant::getNullValue(Int32Ptr1Ty); - - // Make sure that addrspacecast of null is not folded away. - EXPECT_NE(Constant::getNullValue(Int32PtrTy), - ConstantExpr::getAddrSpaceCast(NullInt32Ptr0, Int32Ptr1Ty)); - - EXPECT_NE(Constant::getNullValue(Int32Ptr1Ty), - ConstantExpr::getAddrSpaceCast(NullInt32Ptr1, Int32PtrTy)); -} -#else TEST(ConstantsTest, PointerCast) { LLVMContext C; Type *PtrTy = PointerType::get(C, 0); @@ -248,7 +183,6 @@ TEST(ConstantsTest, PointerCast) { ConstantExpr::getAddrSpaceCast(NullPtr1, PtrTy)); } -#endif #define CHECK(x, y) \ { \ std::string __s; \ @@ -727,11 +661,7 @@ TEST(ConstantsTest, isElementWiseEqual) { EXPECT_FALSE(CF12U2->isElementWiseEqual(CF12U1)); EXPECT_FALSE(CF12U1->isElementWiseEqual(CF12U2)); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - PointerType *PtrTy = Type::getInt8PtrTy(Context); -#else PointerType *PtrTy = PointerType::get(Context, 0); -#endif Constant *CPU = UndefValue::get(PtrTy); Constant *CP0 = ConstantPointerNull::get(PtrTy); diff --git a/llvm/unittests/IR/InstructionsTest.cpp b/llvm/unittests/IR/InstructionsTest.cpp index a1303cce6142a..42bd480eb64e0 100644 --- a/llvm/unittests/IR/InstructionsTest.cpp +++ b/llvm/unittests/IR/InstructionsTest.cpp @@ -634,12 +634,8 @@ TEST(InstructionsTest, isEliminableCastPair) { Type* Int16Ty = Type::getInt16Ty(C); Type* Int32Ty = Type::getInt32Ty(C); - Type* Int64Ty = Type::getInt64Ty(C); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Type* Int64PtrTy = Type::getInt64PtrTy(C); -#else + Type *Int64Ty = Type::getInt64Ty(C); Type *Int64PtrTy = PointerType::get(C, 0); -#endif // Source and destination pointers have same size -> bitcast. EXPECT_EQ(CastInst::isEliminableCastPair(CastInst::PtrToInt, @@ -684,13 +680,8 @@ TEST(InstructionsTest, isEliminableCastPair) { "-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64" "-v128:128:128-a:0:64-s:64:64-f80:128:128-n8:16:32:64-S128"); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Type* Int64PtrTyAS1 = Type::getInt64PtrTy(C, 1); - Type* Int64PtrTyAS2 = Type::getInt64PtrTy(C, 2); -#else Type *Int64PtrTyAS1 = PointerType::get(C, 1); Type *Int64PtrTyAS2 = PointerType::get(C, 2); -#endif IntegerType *Int16SizePtr = DL.getIntPtrType(C, 1); IntegerType *Int64SizePtr = DL.getIntPtrType(C, 2); diff --git a/llvm/unittests/IR/MetadataTest.cpp b/llvm/unittests/IR/MetadataTest.cpp index 55d3cb309fca3..1570631287b2a 100644 --- a/llvm/unittests/IR/MetadataTest.cpp +++ b/llvm/unittests/IR/MetadataTest.cpp @@ -551,11 +551,7 @@ TEST_F(MDNodeTest, UniquedOnDeletedOperand) { TEST_F(MDNodeTest, DistinctOnDeletedValueOperand) { // i1* @GV -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Type *Ty = Type::getInt1PtrTy(Context); -#else Type *Ty = PointerType::getUnqual(Context); -#endif std::unique_ptr GV( new GlobalVariable(Ty, false, GlobalValue::ExternalLinkage)); ConstantAsMetadata *Op = ConstantAsMetadata::get(GV.get()); @@ -794,11 +790,7 @@ TEST_F(MDNodeTest, replaceWithUniquedResolvingOperand) { TEST_F(MDNodeTest, replaceWithUniquedDeletedOperand) { // i1* @GV -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Type *Ty = Type::getInt1PtrTy(Context); -#else Type *Ty = PointerType::getUnqual(Context); -#endif std::unique_ptr GV( new GlobalVariable(Ty, false, GlobalValue::ExternalLinkage)); ConstantAsMetadata *Op = ConstantAsMetadata::get(GV.get()); @@ -821,11 +813,7 @@ TEST_F(MDNodeTest, replaceWithUniquedDeletedOperand) { TEST_F(MDNodeTest, replaceWithUniquedChangedOperand) { // i1* @GV -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Type *Ty = Type::getInt1PtrTy(Context); -#else Type *Ty = PointerType::getUnqual(Context); -#endif std::unique_ptr GV( new GlobalVariable(Ty, false, GlobalValue::ExternalLinkage)); ConstantAsMetadata *Op = ConstantAsMetadata::get(GV.get()); @@ -3723,11 +3711,7 @@ TEST_F(MetadataAsValueTest, MDNodeConstant) { typedef MetadataTest ValueAsMetadataTest; TEST_F(ValueAsMetadataTest, UpdatesOnRAUW) { -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Type *Ty = Type::getInt1PtrTy(Context); -#else Type *Ty = PointerType::getUnqual(Context); -#endif std::unique_ptr GV0( new GlobalVariable(Ty, false, GlobalValue::ExternalLinkage)); auto *MD = ValueAsMetadata::get(GV0.get()); @@ -3799,11 +3783,7 @@ TEST_F(DIArgListTest, get) { } TEST_F(DIArgListTest, UpdatesOnRAUW) { -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Type *Ty = Type::getInt1PtrTy(Context); -#else Type *Ty = PointerType::getUnqual(Context); -#endif ConstantAsMetadata *CI = ConstantAsMetadata::get(ConstantInt::get(Context, APInt(8, 0))); std::unique_ptr GV0( @@ -3828,11 +3808,7 @@ TEST_F(DIArgListTest, UpdatesOnRAUW) { typedef MetadataTest TrackingMDRefTest; TEST_F(TrackingMDRefTest, UpdatesOnRAUW) { -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Type *Ty = Type::getInt1PtrTy(Context); -#else Type *Ty = PointerType::getUnqual(Context); -#endif std::unique_ptr GV0( new GlobalVariable(Ty, false, GlobalValue::ExternalLinkage)); TypedTrackingMDRef MD(ValueAsMetadata::get(GV0.get())); @@ -3849,11 +3825,7 @@ TEST_F(TrackingMDRefTest, UpdatesOnRAUW) { } TEST_F(TrackingMDRefTest, UpdatesOnDeletion) { -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Type *Ty = Type::getInt1PtrTy(Context); -#else Type *Ty = PointerType::getUnqual(Context); -#endif std::unique_ptr GV( new GlobalVariable(Ty, false, GlobalValue::ExternalLinkage)); TypedTrackingMDRef MD(ValueAsMetadata::get(GV.get())); diff --git a/llvm/unittests/Transforms/Utils/CloningTest.cpp b/llvm/unittests/Transforms/Utils/CloningTest.cpp index b5b8c0654abbe..e083c75bf9c92 100644 --- a/llvm/unittests/Transforms/Utils/CloningTest.cpp +++ b/llvm/unittests/Transforms/Utils/CloningTest.cpp @@ -137,11 +137,7 @@ TEST_F(CloneInstruction, OverflowBits) { } TEST_F(CloneInstruction, Inbounds) { -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - V = new Argument(Type::getInt32PtrTy(context)); -#else V = new Argument(PointerType::get(context, 0)); -#endif Constant *Z = Constant::getNullValue(Type::getInt32Ty(context)); std::vector ops; @@ -165,14 +161,9 @@ TEST_F(CloneInstruction, Exact) { } TEST_F(CloneInstruction, Attributes) { -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Type *ArgTy1[] = { Type::getInt32PtrTy(context) }; - FunctionType *FT1 = FunctionType::get(Type::getVoidTy(context), ArgTy1, false); -#else Type *ArgTy1[] = {PointerType::get(context, 0)}; FunctionType *FT1 = FunctionType::get(Type::getVoidTy(context), ArgTy1, false); -#endif Function *F1 = Function::Create(FT1, Function::ExternalLinkage); BasicBlock *BB = BasicBlock::Create(context, "", F1); @@ -197,14 +188,9 @@ TEST_F(CloneInstruction, Attributes) { } TEST_F(CloneInstruction, CallingConvention) { -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Type *ArgTy1[] = { Type::getInt32PtrTy(context) }; - FunctionType *FT1 = FunctionType::get(Type::getVoidTy(context), ArgTy1, false); -#else Type *ArgTy1[] = {PointerType::get(context, 0)}; FunctionType *FT1 = FunctionType::get(Type::getVoidTy(context), ArgTy1, false); -#endif Function *F1 = Function::Create(FT1, Function::ExternalLinkage); F1->setCallingConv(CallingConv::Cold); @@ -227,11 +213,7 @@ TEST_F(CloneInstruction, CallingConvention) { } TEST_F(CloneInstruction, DuplicateInstructionsToSplit) { -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Type *ArgTy1[] = {Type::getInt32PtrTy(context)}; -#else Type *ArgTy1[] = {PointerType::get(context, 0)}; -#endif FunctionType *FT = FunctionType::get(Type::getVoidTy(context), ArgTy1, false); V = new Argument(Type::getInt32Ty(context)); @@ -280,11 +262,7 @@ TEST_F(CloneInstruction, DuplicateInstructionsToSplit) { } TEST_F(CloneInstruction, DuplicateInstructionsToSplitBlocksEq1) { -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Type *ArgTy1[] = {Type::getInt32PtrTy(context)}; -#else Type *ArgTy1[] = {PointerType::get(context, 0)}; -#endif FunctionType *FT = FunctionType::get(Type::getVoidTy(context), ArgTy1, false); V = new Argument(Type::getInt32Ty(context)); @@ -337,11 +315,7 @@ TEST_F(CloneInstruction, DuplicateInstructionsToSplitBlocksEq1) { } TEST_F(CloneInstruction, DuplicateInstructionsToSplitBlocksEq2) { -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Type *ArgTy1[] = {Type::getInt32PtrTy(context)}; -#else Type *ArgTy1[] = {PointerType::get(context, 0)}; -#endif FunctionType *FT = FunctionType::get(Type::getVoidTy(context), ArgTy1, false); V = new Argument(Type::getInt32Ty(context)); diff --git a/llvm/unittests/Transforms/Utils/LocalTest.cpp b/llvm/unittests/Transforms/Utils/LocalTest.cpp index bfd244479ae7e..0525952d15d0a 100644 --- a/llvm/unittests/Transforms/Utils/LocalTest.cpp +++ b/llvm/unittests/Transforms/Utils/LocalTest.cpp @@ -154,11 +154,7 @@ TEST(Local, ReplaceDbgDeclare) { ASSERT_TRUE(Inst); auto *DII = dyn_cast(Inst); ASSERT_TRUE(DII); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - Value *NewBase = Constant::getNullValue(Type::getInt32PtrTy(C)); -#else Value *NewBase = Constant::getNullValue(PointerType::getUnqual(C)); -#endif DIBuilder DIB(*M); replaceDbgDeclare(AI, NewBase, DIB, DIExpression::ApplyOffset, 0); diff --git a/llvm/unittests/Transforms/Utils/ScalarEvolutionExpanderTest.cpp b/llvm/unittests/Transforms/Utils/ScalarEvolutionExpanderTest.cpp index 6da272f36d66d..ca2fc71c4d380 100644 --- a/llvm/unittests/Transforms/Utils/ScalarEvolutionExpanderTest.cpp +++ b/llvm/unittests/Transforms/Utils/ScalarEvolutionExpanderTest.cpp @@ -73,15 +73,9 @@ TEST_F(ScalarEvolutionExpanderTest, ExpandPtrTypeSCEV) { // expansion when the value in ValueOffsetPair is a ptr and the offset // is not divisible by the elem type size of value. auto *I8Ty = Type::getInt8Ty(Context); -#ifndef INTEL_SYCL_OPAQUEPOINTER_READY - auto *I8PtrTy = Type::getInt8PtrTy(Context); - auto *I32Ty = Type::getInt32Ty(Context); - auto *I32PtrTy = Type::getInt32PtrTy(Context); -#else auto *I8PtrTy = PointerType::get(Context, 0); auto *I32Ty = Type::getInt32Ty(Context); auto *I32PtrTy = PointerType::get(Context, 0); -#endif FunctionType *FTy = FunctionType::get(Type::getVoidTy(Context), std::vector(), false); Function *F = Function::Create(FTy, Function::ExternalLinkage, "f", M);