[PATCH] D141680: [GVN] Refactor findDominatingLoad function

Sergei Kachkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 17 09:01:45 PST 2023


kachkov98 added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/GVN.cpp:1128
+      if (auto *LI = dyn_cast<LoadInst>(Inst))
+        if (MemoryLocation::get(LI) == Loc)
+          return LI;
----------------
nikic wrote:
> Can you please add a test where the loads have the same size but different types? I think you need to compare pointer and type here, not location.
Added check that types are the same, in future cast instruction can be generated for such cases (there is also posibility to generate shift + truncate if found load has bigger memory location that is fully covering the needed MemLoc). Memory location instead of pointer value is used to refine clobber check with TBAA (location also stores AA tags) 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141680



More information about the llvm-commits mailing list