[PATCH] D99926: [GVN] Introduce loop load PRE

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 20 09:18:11 PDT 2021


reames accepted this revision.
reames added a comment.
This revision is now accepted and ready to land.

LGTM w/minor comments.



================
Comment at: llvm/lib/Transforms/Scalar/GVN.cpp:1467
+  // We plan to hoist the load to preheader without introducing a new fault.
+  // In irder to do it, we need to prove that we cannot side-exit the loop
+  // once loop header is first entered before execution of the load.
----------------
Type: In order


================
Comment at: llvm/lib/Transforms/Scalar/GVN.cpp:1511
+  Value *LoadPtr = Load->getPointerOperand();
+  if (LoadPtr->canBeFreed())
+    return false;
----------------
In a follow up, please generalize by using stripping bitcasts and inbounds geps before calling canBeFreed.  Please don't do this in the change being lgtmed now.  


================
Comment at: llvm/test/Transforms/GVN/PRE/pre-loop-load.ll:10
 
-; TODO: We can PRE the load from gc-managed memory away from the hot path.
 define i32 @test_load_on_cold_path_gc(i32 addrspace(1)* %p) gc "statepoint-example" personality i32 ()* @"personality_function" {
----------------
Please add a positive test (analogous to this one), but using an alloca.  


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

https://reviews.llvm.org/D99926



More information about the llvm-commits mailing list