[PATCH] D54052: Support for inserting profile-directed cache prefetches

Wei Mi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 7 09:25:58 PST 2018


wmi added inline comments.


================
Comment at: lib/Target/X86/X86InsertPrefetch.cpp:171-172
+      prefetches.clear();
+      if (!findPrefetchInfo(Samples, *Current, prefetches))
+        continue;
+      assert(!prefetches.empty());
----------------
mtrofin wrote:
> wmi wrote:
> > Do you think it is worthy to issue a warning so people know there is some mismatch here? 
> Most instructions won't have prefetch hints provided.
Then is there anyway to check if there is prefetch which cannot find matching memory instruction?


================
Comment at: lib/Target/X86/X86TargetMachine.cpp:500-501
   }
+  addPass(createX86DiscriminateMemOpsPass());
+  addPass(createX86InsertPrefetchPass());
 }
----------------
mtrofin wrote:
> mtrofin wrote:
> > wmi wrote:
> > > wmi wrote:
> > > > Does prefetch insertion need to be guarded by "getOptLevel != CodeGenOpt::None"?
> > > Have you considered to make the two passes architecture independent?
> > Not really, someone might want no optimization and prefetch insertion (although this is a very odd scenario and a very weak argument). Happy to guard it if there's a reason to.
> It's too early for generalizing this outside X86.
I was thinking those two passes can be architecture independent with only x86 hook available currently. But I don't have strong opinion if you feel refactoring that later will not be more difficult. 


Repository:
  rL LLVM

https://reviews.llvm.org/D54052





More information about the llvm-commits mailing list