[llvm] [SimplifyCFG] Don't separate a load/store from its gep during sinking (PR #102318)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 19 17:05:44 PDT 2024


================
@@ -2335,6 +2345,10 @@ static bool sinkCommonCodeFromPredecessors(BasicBlock *BB,
               return InstructionsToSink.contains(V);
             })) {
           ++NumPHIInsts;
+          // Do not separate a load/store from the gep producing the address.
----------------
efriedma-quic wrote:

If I'm following correctly, this is preventing the fold in cases where the GEP would likely fold into the load/store instruction, and the GEP itself won't sink?  That probably makes sense, given the GEP is very likely to fold into the load/store, and it's hard to analyze PHIs.

Maybe expand the comment here a bit.

https://github.com/llvm/llvm-project/pull/102318


More information about the llvm-commits mailing list