[mips] Simplify and optimize code.
authorAkira Hatanaka <ahatanaka@mips.com>
Tue, 8 Oct 2013 18:13:24 +0000 (18:13 +0000)
committerAkira Hatanaka <ahatanaka@mips.com>
Tue, 8 Oct 2013 18:13:24 +0000 (18:13 +0000)
No intended functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192213 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Mips/MipsLongBranch.cpp
lib/Target/Mips/MipsMachineFunction.cpp

index 06bb14a383c4ff6da446914d6ded4496d2d7851f..ea8cc802835e462e8bc6b845d34afb3c1bdff5a4 100644 (file)
@@ -241,7 +241,7 @@ void MipsLongBranch::replaceBranch(MachineBasicBlock &MBB, Iter Br,
   // and erase the original branch.
   assert(Br->isBundledWithSucc());
   MachineBasicBlock::instr_iterator II(Br);
-  MIBundleBuilder(&*MIB).append(llvm::next(II)->removeFromBundle());
+  MIBundleBuilder(&*MIB).append((++II)->removeFromBundle());
   Br->eraseFromParent();
 }
 
index f3f6f2874acac87e07895fd36a5ceef8e780b6f7..dedf802f80ace47c18f28463e75887b09dc43955 100644 (file)
@@ -121,24 +121,20 @@ bool MipsFunctionInfo::isEhDataRegFI(int FI) const {
 }
 
 MachinePointerInfo MipsFunctionInfo::callPtrInfo(const StringRef &Name) {
-  StringMap<const MipsCallEntry *>::const_iterator I;
-  I = ExternalCallEntries.find(Name);
+  const MipsCallEntry *&E = ExternalCallEntries[Name];
 
-  if (I != ExternalCallEntries.end())
-    return MachinePointerInfo(I->getValue());
+  if (!E)
+    E = new MipsCallEntry(Name);
 
-  const MipsCallEntry *E = ExternalCallEntries[Name] = new MipsCallEntry(Name);
   return MachinePointerInfo(E);
 }
 
 MachinePointerInfo MipsFunctionInfo::callPtrInfo(const GlobalValue *Val) {
-  ValueMap<const GlobalValue *, const MipsCallEntry *>::const_iterator I;
-  I = GlobalCallEntries.find(Val);
+  const MipsCallEntry *&E = GlobalCallEntries[Val];
 
-  if (I != GlobalCallEntries.end())
-    return MachinePointerInfo(I->second);
+  if (!E)
+    E = new MipsCallEntry(Val);
 
-  const MipsCallEntry *E = GlobalCallEntries[Val] = new MipsCallEntry(Val);
   return MachinePointerInfo(E);
 }