[llvm] [MachineLICM] Allow hoisting loads from invariant address (PR #70796)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 6 06:13:04 PST 2023


================
@@ -990,9 +1040,10 @@ static bool isCopyFeedingInvariantStore(const MachineInstr &MI,
 
 /// Returns true if the instruction may be a suitable candidate for LICM.
 /// e.g. If the instruction is a call, then it's obviously not safe to hoist it.
-bool MachineLICMBase::IsLICMCandidate(MachineInstr &I, MachineLoop *CurLoop) {
+bool MachineLICMBase::IsLICMCandidate(MachineInstr &I, MachineLoop *CurLoop,
+                                      bool SafeToMoveLoad) {
----------------
david-arm wrote:

Given the candidate could be anything, including a store, the new argument name is a bit confusing. How about renaming this to something like `IsMoveableLoad`? However, if you follow my other suggestion about making `AllowedToHoistLoads` a class member variable then you can just query that anyway. 

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


More information about the llvm-commits mailing list