[llvm] r201974 - LocalStackSlotAllocation: Turn one-iteration loop into if.
Benjamin Kramer
benny.kra at googlemail.com
Sun Feb 23 05:34:21 PST 2014
Author: d0k
Date: Sun Feb 23 07:34:21 2014
New Revision: 201974
URL: http://llvm.org/viewvc/llvm-project?rev=201974&view=rev
Log:
LocalStackSlotAllocation: Turn one-iteration loop into if.
No functionality change.
Modified:
llvm/trunk/lib/CodeGen/LocalStackSlotAllocation.cpp
Modified: llvm/trunk/lib/CodeGen/LocalStackSlotAllocation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LocalStackSlotAllocation.cpp?rev=201974&r1=201973&r2=201974&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LocalStackSlotAllocation.cpp (original)
+++ llvm/trunk/lib/CodeGen/LocalStackSlotAllocation.cpp Sun Feb 23 07:34:21 2014
@@ -377,18 +377,11 @@ bool LocalStackSlotPass::insertFrameRefe
// processed all FrameRefs before this one, just check whether or not
// the next FrameRef will be able to reuse this new register. If not,
// then don't bother creating it.
- bool CanReuse = false;
- for (int refn = ref + 1; refn < e; ++refn) {
- FrameRef &FRN = FrameReferenceInsns[refn];
- MachineBasicBlock::iterator J = FRN.getMachineInstr();
- MachineInstr *MIN = J;
-
- CanReuse = lookupCandidateBaseReg(BaseOffset, FrameSizeAdjust,
- FRN.getLocalOffset(), MIN, TRI);
- break;
- }
-
- if (!CanReuse) {
+ if (ref + 1 >= e ||
+ !lookupCandidateBaseReg(
+ BaseOffset, FrameSizeAdjust,
+ FrameReferenceInsns[ref + 1].getLocalOffset(),
+ FrameReferenceInsns[ref + 1].getMachineInstr(), TRI)) {
BaseOffset = PrevBaseOffset;
continue;
}
More information about the llvm-commits
mailing list