     endOfReferencePrefixComponent.storeBytes(of: componentHeader,
       as: RawKeyPathComponent.Header.self)
   }
-  return (walker.structOffset, walker.isPureStruct)
+  var isPureStruct = true
+  var offset: UInt32? = nil
+      
+  for value in walker.isPureStruct {
+    isPureStruct = isPureStruct && value
+  }
+
+  // Disable the optimization in the general case of 0 components.
+  // Note that a KeyPath such as \SomeStruct.self would still technically
+  // have a valid offset of 0.
+  // TODO: Add the logic to distinguish pure struct
+  // 0-component KeyPaths (tuples too?) from others.
+  if walker.isPureStruct.count == 0 {
+    isPureStruct = false
+  }
+  if isPureStruct {
+      offset = walker.structOffset
+  }
+  return offset
 }
 
 #if SWIFT_ENABLE_REFLECTION

    
    let base = UnsafeRawPointer(Builtin.projectTailElems(self, Int32.self))
    return try f(KeyPathBuffer(base: base))
  }

  // TODO: Find a quicker way to see if this is a tuple.
  internal func isTuple(_ item: Any) -> Bool {
    // Unwraps type information if possible.
    // Otherwise, everything the Mirror handling "item"
    // sees would be "Optional<Any.Type>".
    func unwrapType<T>(_ any: T) -> Any {
      let mirror = Mirror(reflecting: any)
      guard mirror.displayStyle == .optional,
        let first = mirror.children.first
      else {
        return any
      }
      return first.value
    }

    let mirror = Mirror(reflecting: unwrapType(item))
    let description = mirror.description
    let offsetOfFirstBracketForMirrorDescriptionOfTuple = 11
    let idx = description.index(
      description.startIndex,
      offsetBy: offsetOfFirstBracketForMirrorDescriptionOfTuple)
    if description[idx] == "(" {
      return true
    }
    return false
  }
  
  @usableFromInline // Exposed as public API by MemoryLayout<Root>.offset(of:)

    instance._kvcKeyPathStringPtr =
      kvcStringPtr.assumingMemoryBound(to: CChar.self)
  }
  if instance._kvcKeyPathStringPtr == nil, let offset = pureStructOffset {
    instance.assignOffsetToStorage(offset: Int(offset))
  }
  // If we can cache this instance as a shared instance, do so.
