Layer reindexing micro-optimization