mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Change Projection to support signed indices.
Change ProjectionIndex for ref_tail_addr to std::numeric_limits<int>::max(); This is necessary to disambiguate the tail elements from ref_element_addr field zero.
This commit is contained in:
@@ -63,7 +63,7 @@ public:
|
||||
/// Do not form a path with an IndexAddrInst because we have no way to
|
||||
/// distinguish between indexing and subelement access. The same index could
|
||||
/// either refer to the next element (indexed) or a subelement.
|
||||
static SILValue getAccessPath(SILValue V, SmallVectorImpl<unsigned>& Path) {
|
||||
static SILValue getAccessPath(SILValue V, SmallVectorImpl<int> &Path) {
|
||||
V = stripCasts(V);
|
||||
if (auto *IA = dyn_cast<IndexAddrInst>(V)) {
|
||||
// Don't include index_addr projections in the access path. We could if
|
||||
@@ -89,7 +89,7 @@ public:
|
||||
VisitedSet Visited;
|
||||
|
||||
/// Collect all uses of the value at the given address.
|
||||
void collectUses(ValueBase *V, ArrayRef<unsigned> AccessPath) {
|
||||
void collectUses(ValueBase *V, ArrayRef<int> AccessPath) {
|
||||
// Save our old indent and increment.
|
||||
// Collect all users of the address and loads.
|
||||
collectAddressUses(V, AccessPath, nullptr);
|
||||
@@ -142,7 +142,7 @@ protected:
|
||||
/// StructVal is invalid, then the value is the address of the Struct. If
|
||||
/// StructVal is valid, the value is the address of an element within the
|
||||
/// Struct.
|
||||
void collectAddressUses(ValueBase *V, ArrayRef<unsigned> AccessPathSuffix,
|
||||
void collectAddressUses(ValueBase *V, ArrayRef<int> AccessPathSuffix,
|
||||
Operand *StructVal) {
|
||||
for (auto *UI : V->getUses()) {
|
||||
// Keep the operand, not the instruction in the visited set. The same
|
||||
|
||||
Reference in New Issue
Block a user