[PATCH] D85257: [X86] Optimize getImpliedDisabledFeatures & getImpliedEnabledFeatures'

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 4 17:33:21 PDT 2020


MaskRay added inline comments.


================
Comment at: llvm/lib/Support/X86TargetParser.cpp:570
+    Prev = Bits;
+    for (unsigned i = CPU_FEATURE_MAX; i;)
+      if (Bits[--i])
----------------
MaskRay wrote:
> craig.topper wrote:
> > Is there something special about going in reverse here?
> Backward iteration is more efficient.
> 
> If most "implies" edges are forward (i.e. from a smaller index to a larger index; if we organize features from older to newer), one iteration is going to finalize `Bits`. The second iteration will break the loop.
Backward iteration is more efficient.

If most "implies" edges are backward (i.e. from a larger index to a smaller index; if we organize features from older to newer), one sweep is going to finalize Bits. The second sweep will make `Prev == Bits`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85257/new/

https://reviews.llvm.org/D85257



More information about the llvm-commits mailing list