From e74f58ba4b4a3fdbea9ae20f6187c844d5ac007c Mon Sep 17 00:00:00 2001 From: Alina Sbirlea Date: Thu, 8 Mar 2018 19:15:00 +0000 Subject: [PATCH] [MemorySSA] Split PtrIntPair as this fails on win/arm. Summary: Split PtrIntPair into Instruction and OptionalAlias. The latter needs 3 bits, which appear unavailable on certain archs. Subscribers: sanjoy, jlebar, Prazek, llvm-commits, kristof.beyls Differential Revision: https://reviews.llvm.org/D44268 llvm-svn: 327046 --- llvm/include/llvm/Analysis/MemorySSA.h | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/llvm/include/llvm/Analysis/MemorySSA.h b/llvm/include/llvm/Analysis/MemorySSA.h index 34b2f84..2899890 100644 --- a/llvm/include/llvm/Analysis/MemorySSA.h +++ b/llvm/include/llvm/Analysis/MemorySSA.h @@ -249,7 +249,7 @@ public: DECLARE_TRANSPARENT_OPERAND_ACCESSORS(MemoryAccess); /// \brief Get the instruction that this MemoryUse represents. - Instruction *getMemoryInst() const { return MemoryAliasPair.getPointer(); } + Instruction *getMemoryInst() const { return MemoryInstruction; } /// \brief Get the access that produces the memory state used by this Use. MemoryAccess *getDefiningAccess() const { return getOperand(0); } @@ -267,7 +267,7 @@ public: // Retrieve AliasResult type of the optimized access. Ideally this would be // returned by the caching walker and may go away in the future. Optional getOptimizedAccessType() const { - return threeBitIntToOptionalAliasResult(MemoryAliasPair.getInt()); + return OptimizedAccessAlias; } /// \brief Reset the ID of what this MemoryUse was optimized to, causing it to @@ -281,8 +281,8 @@ protected: MemoryUseOrDef(LLVMContext &C, MemoryAccess *DMA, unsigned Vty, DeleteValueTy DeleteValue, Instruction *MI, BasicBlock *BB) - : MemoryAccess(C, Vty, DeleteValue, BB, 1), - MemoryAliasPair(MI, optionalAliasResultToThreeBitInt(MayAlias)) { + : MemoryAccess(C, Vty, DeleteValue, BB, 1), MemoryInstruction(MI), + OptimizedAccessAlias(MayAlias) { setDefiningAccess(DMA); } @@ -290,7 +290,7 @@ protected: ~MemoryUseOrDef() = default; void setOptimizedAccessType(Optional AR) { - MemoryAliasPair.setInt(optionalAliasResultToThreeBitInt(AR)); + OptimizedAccessAlias = AR; } void setDefiningAccess(MemoryAccess *DMA, bool Optimized = false, @@ -304,22 +304,8 @@ protected: } private: - // Pair of memory instruction and Optional with optimized access. - PointerIntPair MemoryAliasPair; - - static int optionalAliasResultToThreeBitInt(Optional OAR) { - if (OAR == None) - return 4; - return (int)OAR.getValue(); - } - - static Optional threeBitIntToOptionalAliasResult(int I) { - assert((I <= 4 && I >= 0) && - "Invalid value for converting to an Optional"); - if (I == 4) - return None; - return (AliasResult)I; - } + Instruction *MemoryInstruction; + Optional OptimizedAccessAlias; }; template <> -- 2.7.4