[llvm] [MachineSink] Add option for aggressive loop sinking (PR #117247)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 21 17:34:06 PST 2024


================
@@ -1574,6 +1615,149 @@ bool MachineSinking::hasStoreBetween(MachineBasicBlock *From,
   return HasAliasedStore;
 }
 
+/// Copy paste from DeadMachineInstructionElimImpl
+
+bool MachineSinking::isDead(const MachineInstr *MI) const {
+  // Instructions without side-effects are dead iff they only define dead regs.
+  // This function is hot and this loop returns early in the common case,
+  // so only perform additional checks before this if absolutely necessary.
+  for (const MachineOperand &MO : MI->all_defs()) {
+    Register Reg = MO.getReg();
+    if (Reg.isPhysical()) {
+      return false;
+    } else {
----------------
arsenm wrote:

No else after return 

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


More information about the llvm-commits mailing list