[PATCH] D44268: [MemorySSA] Split PtrIntPair as this fails on win/arm.
Alina Sbirlea via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 8 11:12:29 PST 2018
asbirlea created this revision.
Herald added subscribers: kristof.beyls, Prazek, jlebar, sanjoy.
Split PtrIntPair into Instruction and OptionalAlias<Result>. The latter needs 3 bits, which appear unavailable on certain archs.
Repository:
rL LLVM
https://reviews.llvm.org/D44268
Files:
include/llvm/Analysis/MemorySSA.h
Index: include/llvm/Analysis/MemorySSA.h
===================================================================
--- include/llvm/Analysis/MemorySSA.h
+++ include/llvm/Analysis/MemorySSA.h
@@ -249,7 +249,7 @@
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 @@
// Retrieve AliasResult type of the optimized access. Ideally this would be
// returned by the caching walker and may go away in the future.
Optional<AliasResult> getOptimizedAccessType() const {
- return threeBitIntToOptionalAliasResult(MemoryAliasPair.getInt());
+ return OptimizedAccessAlias;
}
/// \brief Reset the ID of what this MemoryUse was optimized to, causing it to
@@ -281,16 +281,16 @@
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);
}
// Use deleteValue() to delete a generic MemoryUseOrDef.
~MemoryUseOrDef() = default;
void setOptimizedAccessType(Optional<AliasResult> AR) {
- MemoryAliasPair.setInt(optionalAliasResultToThreeBitInt(AR));
+ OptimizedAccessAlias = AR;
}
void setDefiningAccess(MemoryAccess *DMA, bool Optimized = false,
@@ -304,22 +304,8 @@
}
private:
- // Pair of memory instruction and Optional<AliasResult> with optimized access.
- PointerIntPair<Instruction *, 3, int> MemoryAliasPair;
-
- static int optionalAliasResultToThreeBitInt(Optional<AliasResult> OAR) {
- if (OAR == None)
- return 4;
- return (int)OAR.getValue();
- }
-
- static Optional<AliasResult> threeBitIntToOptionalAliasResult(int I) {
- assert((I <= 4 && I >= 0) &&
- "Invalid value for converting to an Optional<AliasResult>");
- if (I == 4)
- return None;
- return (AliasResult)I;
- }
+ Instruction *MemoryInstruction;
+ Optional<AliasResult> OptimizedAccessAlias;
};
template <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44268.137619.patch
Type: text/x-patch
Size: 2507 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180308/b2028de2/attachment.bin>
More information about the llvm-commits
mailing list