Don't call isInvariantLoad twice.
authorEvan Cheng <evan.cheng@apple.com>
Wed, 4 Feb 2009 09:21:58 +0000 (09:21 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Wed, 4 Feb 2009 09:21:58 +0000 (09:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63729 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/MachineLICM.cpp

index 0a9f7207b1f980e88536721fb10efb5c6b009c88..10ee8d6d137e82e13eb9a46d563acb6283493fa6 100644 (file)
@@ -276,18 +276,11 @@ static bool HasOnlyPHIUses(unsigned Reg, MachineRegisterInfo *RegInfo) {
 bool MachineLICM::IsProfitableToHoist(MachineInstr &MI) {
   const TargetInstrDesc &TID = MI.getDesc();
 
-  bool isInvLoad = false;
-  if (TID.mayLoad()) {
-    isInvLoad = TII->isInvariantLoad(&MI);
-    if (!isInvLoad)
-      return false;
-  }
-
   // FIXME: For now, only hoist re-materilizable instructions. LICM will
   // increase register pressure. We want to make sure it doesn't increase
   // spilling.
-  if (!isInvLoad && (!TID.isRematerializable() ||
-                     !TII->isTriviallyReMaterializable(&MI)))
+  if (!TID.mayLoad() && (!TID.isRematerializable() ||
+                         !TII->isTriviallyReMaterializable(&MI)))
     return false;
 
   if (!TID.isAsCheapAsAMove())