<div dir="ltr">Hi Benjamin,<div><br></div><div style>I'm afraid this change broke our LNT buildbot. I just finished doing a binary search and your patch seems to be the guilty one.</div><div style><br></div><div style>
<a href="http://lab.llvm.org:8011/builders/clang-native-arm-lnt/builds/1506">http://lab.llvm.org:8011/builders/clang-native-arm-lnt/builds/1506</a><br></div><div style><br></div><div style>It causes an segmentation fault on MultiSource/Applications/JM/lencod:</div>
<div style><br></div><div style><div>/home/user/devel/llvm/test/sandbox/test-2013-06-18_16-36-22/tools/timeit-target: error: child terminated by signal 11</div><div><br></div><div style>cheers,</div><div style>--renato</div>
<div><br></div></div><div style><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 17 June 2013 20:00, Benjamin Kramer <span dir="ltr"><<a href="mailto:benny.kra@googlemail.com" target="_blank">benny.kra@googlemail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: d0k<br>
Date: Mon Jun 17 14:00:36 2013<br>
New Revision: 184105<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=184105&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=184105&view=rev</a><br>
Log:<br>
Switch spill weights from a basic loop depth estimation to BlockFrequencyInfo.<br>
<br>
The main advantages here are way better heuristics, taking into account not<br>
just loop depth but also __builtin_expect and other static heuristics and will<br>
eventually learn how to use profile info. Most of the work in this patch is<br>
pushing the MachineBlockFrequencyInfo analysis into the right places.<br>
<br>
This is good for a 5% speedup on zlib's deflate (x86_64), there were some very<br>
unfortunate spilling decisions in its hottest loop in longest_match(). Other<br>
benchmarks I tried were mostly neutral.<br>
<br>
This changes register allocation in subtle ways, update the tests for it.<br>
2012-02-20-MachineCPBug.ll was deleted as it's very fragile and the instruction<br>
it looked for was gone already (but the FileCheck pattern picked up unrelated<br>
stuff).<br>
<br>
Removed:<br>
llvm/trunk/test/CodeGen/X86/2012-02-20-MachineCPBug.ll<br>
Modified:<br>
llvm/trunk/include/llvm/CodeGen/CalcSpillWeights.h<br>
llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h<br>
llvm/trunk/include/llvm/CodeGen/LiveRangeEdit.h<br>
llvm/trunk/include/llvm/CodeGen/RegAllocPBQP.h<br>
llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp<br>
llvm/trunk/lib/CodeGen/InlineSpiller.cpp<br>
llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp<br>
llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp<br>
llvm/trunk/lib/CodeGen/RegAllocBasic.cpp<br>
llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp<br>
llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp<br>
llvm/trunk/lib/CodeGen/SpillPlacement.cpp<br>
llvm/trunk/lib/CodeGen/SplitKit.cpp<br>
llvm/trunk/lib/CodeGen/SplitKit.h<br>
llvm/trunk/lib/CodeGen/StackSlotColoring.cpp<br>
llvm/trunk/test/CodeGen/ARM/lsr-unfolded-offset.ll<br>
llvm/trunk/test/CodeGen/SPARC/2011-01-19-DelaySlot.ll<br>
llvm/trunk/test/CodeGen/X86/atom-bypass-slow-division-64.ll<br>
<br>
Modified: llvm/trunk/include/llvm/CodeGen/CalcSpillWeights.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/CalcSpillWeights.h?rev=184105&r1=184104&r2=184105&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/CalcSpillWeights.h?rev=184105&r1=184104&r2=184105&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/CodeGen/CalcSpillWeights.h (original)<br>
+++ llvm/trunk/include/llvm/CodeGen/CalcSpillWeights.h Mon Jun 17 14:00:36 2013<br>
@@ -18,6 +18,7 @@ namespace llvm {<br>
<br>
class LiveInterval;<br>
class LiveIntervals;<br>
+ class MachineBlockFrequencyInfo;<br>
class MachineLoopInfo;<br>
<br>
/// normalizeSpillWeight - The spill weight of a live interval is computed as:<br>
@@ -43,11 +44,13 @@ namespace llvm {<br>
MachineFunction &MF;<br>
LiveIntervals &LIS;<br>
const MachineLoopInfo &Loops;<br>
+ const MachineBlockFrequencyInfo &MBFI;<br>
DenseMap<unsigned, float> Hint;<br>
public:<br>
VirtRegAuxInfo(MachineFunction &mf, LiveIntervals &lis,<br>
- const MachineLoopInfo &loops) :<br>
- MF(mf), LIS(lis), Loops(loops) {}<br>
+ const MachineLoopInfo &loops,<br>
+ const MachineBlockFrequencyInfo &mbfi)<br>
+ : MF(mf), LIS(lis), Loops(loops), MBFI(mbfi) {}<br>
<br>
/// CalculateWeightAndHint - (re)compute li's spill weight and allocation<br>
/// hint.<br>
<br>
Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=184105&r1=184104&r2=184105&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=184105&r1=184104&r2=184105&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original)<br>
+++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Mon Jun 17 14:00:36 2013<br>
@@ -35,6 +35,7 @@ namespace llvm {<br>
<br>
class AliasAnalysis;<br>
class BitVector;<br>
+ class BlockFrequency;<br>
class LiveRangeCalc;<br>
class LiveVariables;<br>
class MachineDominatorTree;<br>
@@ -99,7 +100,7 @@ namespace llvm {<br>
virtual ~LiveIntervals();<br>
<br>
// Calculate the spill weight to assign to a single instruction.<br>
- static float getSpillWeight(bool isDef, bool isUse, unsigned loopDepth);<br>
+ static float getSpillWeight(bool isDef, bool isUse, BlockFrequency freq);<br>
<br>
LiveInterval &getInterval(unsigned Reg) {<br>
LiveInterval *LI = VirtRegIntervals[Reg];<br>
<br>
Modified: llvm/trunk/include/llvm/CodeGen/LiveRangeEdit.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveRangeEdit.h?rev=184105&r1=184104&r2=184105&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveRangeEdit.h?rev=184105&r1=184104&r2=184105&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/CodeGen/LiveRangeEdit.h (original)<br>
+++ llvm/trunk/include/llvm/CodeGen/LiveRangeEdit.h Mon Jun 17 14:00:36 2013<br>
@@ -27,6 +27,7 @@ namespace llvm {<br>
<br>
class AliasAnalysis;<br>
class LiveIntervals;<br>
+class MachineBlockFrequencyInfo;<br>
class MachineLoopInfo;<br>
class MachineRegisterInfo;<br>
class VirtRegMap;<br>
@@ -201,7 +202,8 @@ public:<br>
/// calculateRegClassAndHint - Recompute register class and hint for each new<br>
/// register.<br>
void calculateRegClassAndHint(MachineFunction&,<br>
- const MachineLoopInfo&);<br>
+ const MachineLoopInfo&,<br>
+ const MachineBlockFrequencyInfo&);<br>
};<br>
<br>
}<br>
<br>
Modified: llvm/trunk/include/llvm/CodeGen/RegAllocPBQP.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/RegAllocPBQP.h?rev=184105&r1=184104&r2=184105&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/RegAllocPBQP.h?rev=184105&r1=184104&r2=184105&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/CodeGen/RegAllocPBQP.h (original)<br>
+++ llvm/trunk/include/llvm/CodeGen/RegAllocPBQP.h Mon Jun 17 14:00:36 2013<br>
@@ -26,8 +26,8 @@<br>
namespace llvm {<br>
<br>
class LiveIntervals;<br>
+ class MachineBlockFrequencyInfo;<br>
class MachineFunction;<br>
- class MachineLoopInfo;<br>
class TargetRegisterInfo;<br>
template<class T> class OwningPtr;<br>
<br>
@@ -125,7 +125,7 @@ namespace llvm {<br>
/// Build a PBQP instance to represent the register allocation problem for<br>
/// the given MachineFunction.<br>
virtual PBQPRAProblem *build(MachineFunction *mf, const LiveIntervals *lis,<br>
- const MachineLoopInfo *loopInfo,<br>
+ const MachineBlockFrequencyInfo *mbfi,<br>
const RegSet &vregs);<br>
private:<br>
<br>
@@ -144,7 +144,7 @@ namespace llvm {<br>
/// Build a PBQP instance to represent the register allocation problem for<br>
/// the given MachineFunction.<br>
virtual PBQPRAProblem *build(MachineFunction *mf, const LiveIntervals *lis,<br>
- const MachineLoopInfo *loopInfo,<br>
+ const MachineBlockFrequencyInfo *mbfi,<br>
const RegSet &vregs);<br>
<br>
private:<br>
<br>
Modified: llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp?rev=184105&r1=184104&r2=184105&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp?rev=184105&r1=184104&r2=184105&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp Mon Jun 17 14:00:36 2013<br>
@@ -12,6 +12,7 @@<br>
#include "llvm/ADT/SmallSet.h"<br>
#include "llvm/CodeGen/CalcSpillWeights.h"<br>
#include "llvm/CodeGen/LiveIntervalAnalysis.h"<br>
+#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"<br>
#include "llvm/CodeGen/MachineFunction.h"<br>
#include "llvm/CodeGen/MachineLoopInfo.h"<br>
#include "llvm/CodeGen/MachineRegisterInfo.h"<br>
@@ -33,6 +34,7 @@ INITIALIZE_PASS_END(CalculateSpillWeight<br>
<br>
void CalculateSpillWeights::getAnalysisUsage(AnalysisUsage &au) const {<br>
au.addRequired<LiveIntervals>();<br>
+ au.addRequired<MachineBlockFrequencyInfo>();<br>
au.addRequired<MachineLoopInfo>();<br>
au.setPreservesAll();<br>
MachineFunctionPass::getAnalysisUsage(au);<br>
@@ -45,7 +47,8 @@ bool CalculateSpillWeights::runOnMachine<br>
<br>
LiveIntervals &LIS = getAnalysis<LiveIntervals>();<br>
MachineRegisterInfo &MRI = MF.getRegInfo();<br>
- VirtRegAuxInfo VRAI(MF, LIS, getAnalysis<MachineLoopInfo>());<br>
+ VirtRegAuxInfo VRAI(MF, LIS, getAnalysis<MachineLoopInfo>(),<br>
+ getAnalysis<MachineBlockFrequencyInfo>());<br>
for (unsigned i = 0, e = MRI.getNumVirtRegs(); i != e; ++i) {<br>
unsigned Reg = TargetRegisterInfo::index2VirtReg(i);<br>
if (MRI.reg_nodbg_empty(Reg))<br>
@@ -107,12 +110,12 @@ static bool isRematerializable(const Liv<br>
return true;<br>
}<br>
<br>
-void VirtRegAuxInfo::CalculateWeightAndHint(LiveInterval &li) {<br>
+void<br>
+VirtRegAuxInfo::CalculateWeightAndHint(LiveInterval &li) {<br>
MachineRegisterInfo &mri = MF.getRegInfo();<br>
const TargetRegisterInfo &tri = *MF.getTarget().getRegisterInfo();<br>
MachineBasicBlock *mbb = 0;<br>
MachineLoop *loop = 0;<br>
- unsigned loopDepth = 0;<br>
bool isExiting = false;<br>
float totalWeight = 0;<br>
SmallPtrSet<MachineInstr*, 8> visited;<br>
@@ -140,14 +143,14 @@ void VirtRegAuxInfo::CalculateWeightAndH<br>
if (mi->getParent() != mbb) {<br>
mbb = mi->getParent();<br>
loop = Loops.getLoopFor(mbb);<br>
- loopDepth = loop ? loop->getLoopDepth() : 0;<br>
isExiting = loop ? loop->isLoopExiting(mbb) : false;<br>
}<br>
<br>
// Calculate instr weight.<br>
bool reads, writes;<br>
tie(reads, writes) = mi->readsWritesVirtualRegister(li.reg);<br>
- weight = LiveIntervals::getSpillWeight(writes, reads, loopDepth);<br>
+ weight = LiveIntervals::getSpillWeight(<br>
+ writes, reads, MBFI.getBlockFreq(mi->getParent()));<br>
<br>
// Give extra weight to what looks like a loop induction variable update.<br>
if (writes && isExiting && LIS.isLiveOutOfMBB(li, mbb))<br>
<br>
Modified: llvm/trunk/lib/CodeGen/InlineSpiller.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/InlineSpiller.cpp?rev=184105&r1=184104&r2=184105&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/InlineSpiller.cpp?rev=184105&r1=184104&r2=184105&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/InlineSpiller.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/InlineSpiller.cpp Mon Jun 17 14:00:36 2013<br>
@@ -22,6 +22,7 @@<br>
#include "llvm/CodeGen/LiveRangeEdit.h"<br>
#include "llvm/CodeGen/LiveStackAnalysis.h"<br>
#include "llvm/CodeGen/MachineDominators.h"<br>
+#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"<br>
#include "llvm/CodeGen/MachineFrameInfo.h"<br>
#include "llvm/CodeGen/MachineFunction.h"<br>
#include "llvm/CodeGen/MachineInstrBuilder.h"<br>
@@ -65,6 +66,7 @@ class InlineSpiller : public Spiller {<br>
MachineRegisterInfo &MRI;<br>
const TargetInstrInfo &TII;<br>
const TargetRegisterInfo &TRI;<br>
+ const MachineBlockFrequencyInfo &MBFI;<br>
<br>
// Variables that are valid during spill(), but used by multiple methods.<br>
LiveRangeEdit *Edit;<br>
@@ -148,7 +150,8 @@ public:<br>
MFI(*mf.getFrameInfo()),<br>
MRI(mf.getRegInfo()),<br>
TII(*mf.getTarget().getInstrInfo()),<br>
- TRI(*mf.getTarget().getRegisterInfo()) {}<br>
+ TRI(*mf.getTarget().getRegisterInfo()),<br>
+ MBFI(pass.getAnalysis<MachineBlockFrequencyInfo>()) {}<br>
<br>
void spill(LiveRangeEdit &);<br>
<br>
@@ -1290,5 +1293,5 @@ void InlineSpiller::spill(LiveRangeEdit<br>
if (!RegsToSpill.empty())<br>
spillAll();<br>
<br>
- Edit->calculateRegClassAndHint(MF, Loops);<br>
+ Edit->calculateRegClassAndHint(MF, Loops, MBFI);<br>
}<br>
<br>
Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=184105&r1=184104&r2=184105&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=184105&r1=184104&r2=184105&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Mon Jun 17 14:00:36 2013<br>
@@ -28,6 +28,7 @@<br>
#include "llvm/CodeGen/Passes.h"<br>
#include "llvm/CodeGen/VirtRegMap.h"<br>
#include "llvm/IR/Value.h"<br>
+#include "llvm/Support/BlockFrequency.h"<br>
#include "llvm/Support/CommandLine.h"<br>
#include "llvm/Support/Debug.h"<br>
#include "llvm/Support/ErrorHandling.h"<br>
@@ -605,21 +606,9 @@ LiveIntervals::hasPHIKill(const LiveInte<br>
}<br>
<br>
float<br>
-LiveIntervals::getSpillWeight(bool isDef, bool isUse, unsigned loopDepth) {<br>
- // Limit the loop depth ridiculousness.<br>
- if (loopDepth > 200)<br>
- loopDepth = 200;<br>
-<br>
- // The loop depth is used to roughly estimate the number of times the<br>
- // instruction is executed. Something like 10^d is simple, but will quickly<br>
- // overflow a float. This expression behaves like 10^d for small d, but is<br>
- // more tempered for large d. At d=200 we get 6.7e33 which leaves a bit of<br>
- // headroom before overflow.<br>
- // By the way, powf() might be unavailable here. For consistency,<br>
- // We may take pow(double,double).<br>
- float lc = std::pow(1 + (100.0 / (loopDepth + 10)), (double)loopDepth);<br>
-<br>
- return (isDef + isUse) * lc;<br>
+LiveIntervals::getSpillWeight(bool isDef, bool isUse, BlockFrequency freq) {<br>
+ const float Scale = 1.0f / BlockFrequency::getEntryFrequency();<br>
+ return (isDef + isUse) * (freq.getFrequency() * Scale);<br>
}<br>
<br>
LiveRange LiveIntervals::addLiveRangeToEndOfBlock(unsigned reg,<br>
<br>
Modified: llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp?rev=184105&r1=184104&r2=184105&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp?rev=184105&r1=184104&r2=184105&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp Mon Jun 17 14:00:36 2013<br>
@@ -374,9 +374,11 @@ void LiveRangeEdit::eliminateDeadDefs(Sm<br>
}<br>
}<br>
<br>
-void LiveRangeEdit::calculateRegClassAndHint(MachineFunction &MF,<br>
- const MachineLoopInfo &Loops) {<br>
- VirtRegAuxInfo VRAI(MF, LIS, Loops);<br>
+void<br>
+LiveRangeEdit::calculateRegClassAndHint(MachineFunction &MF,<br>
+ const MachineLoopInfo &Loops,<br>
+ const MachineBlockFrequencyInfo &MBFI) {<br>
+ VirtRegAuxInfo VRAI(MF, LIS, Loops, MBFI);<br>
for (iterator I = begin(), E = end(); I != E; ++I) {<br>
LiveInterval &LI = **I;<br>
if (MRI.recomputeRegClass(LI.reg, MF.getTarget()))<br>
<br>
Modified: llvm/trunk/lib/CodeGen/RegAllocBasic.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocBasic.cpp?rev=184105&r1=184104&r2=184105&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocBasic.cpp?rev=184105&r1=184104&r2=184105&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/RegAllocBasic.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/RegAllocBasic.cpp Mon Jun 17 14:00:36 2013<br>
@@ -24,6 +24,7 @@<br>
#include "llvm/CodeGen/LiveRangeEdit.h"<br>
#include "llvm/CodeGen/LiveRegMatrix.h"<br>
#include "llvm/CodeGen/LiveStackAnalysis.h"<br>
+#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"<br>
#include "llvm/CodeGen/MachineFunctionPass.h"<br>
#include "llvm/CodeGen/MachineInstr.h"<br>
#include "llvm/CodeGen/MachineLoopInfo.h"<br>
@@ -145,6 +146,8 @@ void RABasic::getAnalysisUsage(AnalysisU<br>
AU.addRequired<CalculateSpillWeights>();<br>
AU.addRequired<LiveStacks>();<br>
AU.addPreserved<LiveStacks>();<br>
+ AU.addRequired<MachineBlockFrequencyInfo>();<br>
+ AU.addPreserved<MachineBlockFrequencyInfo>();<br>
AU.addRequiredID(MachineDominatorsID);<br>
AU.addPreservedID(MachineDominatorsID);<br>
AU.addRequired<MachineLoopInfo>();<br>
<br>
Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp?rev=184105&r1=184104&r2=184105&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp?rev=184105&r1=184104&r2=184105&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Mon Jun 17 14:00:36 2013<br>
@@ -29,6 +29,7 @@<br>
#include "llvm/CodeGen/LiveRangeEdit.h"<br>
#include "llvm/CodeGen/LiveRegMatrix.h"<br>
#include "llvm/CodeGen/LiveStackAnalysis.h"<br>
+#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"<br>
#include "llvm/CodeGen/MachineDominators.h"<br>
#include "llvm/CodeGen/MachineFunctionPass.h"<br>
#include "llvm/CodeGen/MachineLoopInfo.h"<br>
@@ -71,6 +72,7 @@ class RAGreedy : public MachineFunctionP<br>
<br>
// analyses<br>
SlotIndexes *Indexes;<br>
+ MachineBlockFrequencyInfo *MBFI;<br>
MachineDominatorTree *DomTree;<br>
MachineLoopInfo *Loops;<br>
EdgeBundles *Bundles;<br>
@@ -320,6 +322,8 @@ RAGreedy::RAGreedy(): MachineFunctionPas<br>
<br>
void RAGreedy::getAnalysisUsage(AnalysisUsage &AU) const {<br>
AU.setPreservesCFG();<br>
+ AU.addRequired<MachineBlockFrequencyInfo>();<br>
+ AU.addPreserved<MachineBlockFrequencyInfo>();<br>
AU.addRequired<AliasAnalysis>();<br>
AU.addPreserved<AliasAnalysis>();<br>
AU.addRequired<LiveIntervals>();<br>
@@ -1770,6 +1774,7 @@ bool RAGreedy::runOnMachineFunction(Mach<br>
getAnalysis<LiveIntervals>(),<br>
getAnalysis<LiveRegMatrix>());<br>
Indexes = &getAnalysis<SlotIndexes>();<br>
+ MBFI = &getAnalysis<MachineBlockFrequencyInfo>();<br>
DomTree = &getAnalysis<MachineDominatorTree>();<br>
SpillerInstance.reset(createInlineSpiller(*this, *MF, *VRM));<br>
Loops = &getAnalysis<MachineLoopInfo>();<br>
@@ -1778,7 +1783,7 @@ bool RAGreedy::runOnMachineFunction(Mach<br>
DebugVars = &getAnalysis<LiveDebugVariables>();<br>
<br>
SA.reset(new SplitAnalysis(*VRM, *LIS, *Loops));<br>
- SE.reset(new SplitEditor(*SA, *LIS, *VRM, *DomTree));<br>
+ SE.reset(new SplitEditor(*SA, *LIS, *VRM, *DomTree, *MBFI));<br>
ExtraRegInfo.clear();<br>
ExtraRegInfo.resize(MRI->getNumVirtRegs());<br>
NextCascade = 1;<br>
<br>
Modified: llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp?rev=184105&r1=184104&r2=184105&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp?rev=184105&r1=184104&r2=184105&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp Mon Jun 17 14:00:36 2013<br>
@@ -40,9 +40,9 @@<br>
#include "llvm/CodeGen/LiveIntervalAnalysis.h"<br>
#include "llvm/CodeGen/LiveRangeEdit.h"<br>
#include "llvm/CodeGen/LiveStackAnalysis.h"<br>
+#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"<br>
#include "llvm/CodeGen/MachineDominators.h"<br>
#include "llvm/CodeGen/MachineFunctionPass.h"<br>
-#include "llvm/CodeGen/MachineLoopInfo.h"<br>
#include "llvm/CodeGen/MachineRegisterInfo.h"<br>
#include "llvm/CodeGen/PBQP/Graph.h"<br>
#include "llvm/CodeGen/PBQP/HeuristicSolver.h"<br>
@@ -96,7 +96,6 @@ public:<br>
initializeLiveIntervalsPass(*PassRegistry::getPassRegistry());<br>
initializeCalculateSpillWeightsPass(*PassRegistry::getPassRegistry());<br>
initializeLiveStacksPass(*PassRegistry::getPassRegistry());<br>
- initializeMachineLoopInfoPass(*PassRegistry::getPassRegistry());<br>
initializeVirtRegMapPass(*PassRegistry::getPassRegistry());<br>
}<br>
<br>
@@ -130,8 +129,8 @@ private:<br>
const TargetMachine *tm;<br>
const TargetRegisterInfo *tri;<br>
const TargetInstrInfo *tii;<br>
- const MachineLoopInfo *loopInfo;<br>
MachineRegisterInfo *mri;<br>
+ const MachineBlockFrequencyInfo *mbfi;<br>
<br>
OwningPtr<Spiller> spiller;<br>
LiveIntervals *lis;<br>
@@ -188,7 +187,7 @@ unsigned PBQPRAProblem::getPRegForOption<br>
}<br>
<br>
PBQPRAProblem *PBQPBuilder::build(MachineFunction *mf, const LiveIntervals *lis,<br>
- const MachineLoopInfo *loopInfo,<br>
+ const MachineBlockFrequencyInfo *mbfi,<br>
const RegSet &vregs) {<br>
<br>
LiveIntervals *LIS = const_cast<LiveIntervals*>(lis);<br>
@@ -313,10 +312,10 @@ void PBQPBuilder::addInterferenceCosts(<br>
<br>
PBQPRAProblem *PBQPBuilderWithCoalescing::build(MachineFunction *mf,<br>
const LiveIntervals *lis,<br>
- const MachineLoopInfo *loopInfo,<br>
+ const MachineBlockFrequencyInfo *mbfi,<br>
const RegSet &vregs) {<br>
<br>
- OwningPtr<PBQPRAProblem> p(PBQPBuilder::build(mf, lis, loopInfo, vregs));<br>
+ OwningPtr<PBQPRAProblem> p(PBQPBuilder::build(mf, lis, mbfi, vregs));<br>
PBQP::Graph &g = p->getGraph();<br>
<br>
const TargetMachine &tm = mf->getTarget();<br>
@@ -350,7 +349,7 @@ PBQPRAProblem *PBQPBuilderWithCoalescing<br>
<br>
PBQP::PBQPNum cBenefit =<br>
copyFactor * LiveIntervals::getSpillWeight(false, true,<br>
- loopInfo->getLoopDepth(mbb));<br>
+ mbfi->getBlockFreq(mbb));<br>
<br>
if (cp.isPhys()) {<br>
if (!mf->getRegInfo().isAllocatable(dst)) {<br>
@@ -435,10 +434,10 @@ void RegAllocPBQP::getAnalysisUsage(Anal<br>
au.addRequired<CalculateSpillWeights>();<br>
au.addRequired<LiveStacks>();<br>
au.addPreserved<LiveStacks>();<br>
+ au.addRequired<MachineBlockFrequencyInfo>();<br>
+ au.addPreserved<MachineBlockFrequencyInfo>();<br>
au.addRequired<MachineDominatorTree>();<br>
au.addPreserved<MachineDominatorTree>();<br>
- au.addRequired<MachineLoopInfo>();<br>
- au.addPreserved<MachineLoopInfo>();<br>
au.addRequired<VirtRegMap>();<br>
au.addPreserved<VirtRegMap>();<br>
MachineFunctionPass::getAnalysisUsage(au);<br>
@@ -546,7 +545,7 @@ bool RegAllocPBQP::runOnMachineFunction(<br>
<br>
lis = &getAnalysis<LiveIntervals>();<br>
lss = &getAnalysis<LiveStacks>();<br>
- loopInfo = &getAnalysis<MachineLoopInfo>();<br>
+ mbfi = &getAnalysis<MachineBlockFrequencyInfo>();<br>
<br>
vrm = &getAnalysis<VirtRegMap>();<br>
spiller.reset(createInlineSpiller(*this, MF, *vrm));<br>
@@ -584,7 +583,7 @@ bool RegAllocPBQP::runOnMachineFunction(<br>
DEBUG(dbgs() << " PBQP Regalloc round " << round << ":\n");<br>
<br>
OwningPtr<PBQPRAProblem> problem(<br>
- builder->build(mf, lis, loopInfo, vregsToAlloc));<br>
+ builder->build(mf, lis, mbfi, vregsToAlloc));<br>
<br>
#ifndef NDEBUG<br>
if (pbqpDumpGraphs) {<br>
<br>
Modified: llvm/trunk/lib/CodeGen/SpillPlacement.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SpillPlacement.cpp?rev=184105&r1=184104&r2=184105&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SpillPlacement.cpp?rev=184105&r1=184104&r2=184105&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/SpillPlacement.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/SpillPlacement.cpp Mon Jun 17 14:00:36 2013<br>
@@ -31,8 +31,8 @@<br>
#include "SpillPlacement.h"<br>
#include "llvm/ADT/BitVector.h"<br>
#include "llvm/CodeGen/EdgeBundles.h"<br>
-#include "llvm/CodeGen/LiveIntervalAnalysis.h"<br>
#include "llvm/CodeGen/MachineBasicBlock.h"<br>
+#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"<br>
#include "llvm/CodeGen/MachineFunction.h"<br>
#include "llvm/CodeGen/MachineLoopInfo.h"<br>
#include "llvm/CodeGen/Passes.h"<br>
@@ -53,6 +53,7 @@ char &llvm::SpillPlacementID = SpillPlac<br>
<br>
void SpillPlacement::getAnalysisUsage(AnalysisUsage &AU) const {<br>
AU.setPreservesAll();<br>
+ AU.addRequired<MachineBlockFrequencyInfo>();<br>
AU.addRequiredTransitive<EdgeBundles>();<br>
AU.addRequiredTransitive<MachineLoopInfo>();<br>
MachineFunctionPass::getAnalysisUsage(AU);<br>
@@ -178,9 +179,10 @@ bool SpillPlacement::runOnMachineFunctio<br>
<br>
// Compute total ingoing and outgoing block frequencies for all bundles.<br>
BlockFrequency.resize(mf.getNumBlockIDs());<br>
+ MachineBlockFrequencyInfo &MBFI = getAnalysis<MachineBlockFrequencyInfo>();<br>
+ float EntryFreq = BlockFrequency::getEntryFrequency();<br>
for (MachineFunction::iterator I = mf.begin(), E = mf.end(); I != E; ++I) {<br>
- float Freq = LiveIntervals::getSpillWeight(true, false,<br>
- loops->getLoopDepth(I));<br>
+ float Freq = MBFI.getBlockFreq(I).getFrequency() / EntryFreq;<br>
unsigned Num = I->getNumber();<br>
BlockFrequency[Num] = Freq;<br>
nodes[bundles->getBundle(Num, 1)].Scale[0] += Freq;<br>
<br>
Modified: llvm/trunk/lib/CodeGen/SplitKit.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.cpp?rev=184105&r1=184104&r2=184105&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.cpp?rev=184105&r1=184104&r2=184105&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/SplitKit.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/SplitKit.cpp Mon Jun 17 14:00:36 2013<br>
@@ -325,12 +325,14 @@ void SplitAnalysis::analyze(const LiveIn<br>
SplitEditor::SplitEditor(SplitAnalysis &sa,<br>
LiveIntervals &lis,<br>
VirtRegMap &vrm,<br>
- MachineDominatorTree &mdt)<br>
+ MachineDominatorTree &mdt,<br>
+ MachineBlockFrequencyInfo &mbfi)<br>
: SA(sa), LIS(lis), VRM(vrm),<br>
MRI(vrm.getMachineFunction().getRegInfo()),<br>
MDT(mdt),<br>
TII(*vrm.getMachineFunction().getTarget().getInstrInfo()),<br>
TRI(*vrm.getMachineFunction().getTarget().getRegisterInfo()),<br>
+ MBFI(mbfi),<br>
Edit(0),<br>
OpenIdx(0),<br>
SpillMode(SM_Partition),<br>
@@ -1119,7 +1121,7 @@ void SplitEditor::finish(SmallVectorImpl<br>
}<br>
<br>
// Calculate spill weight and allocation hints for new intervals.<br>
- Edit->calculateRegClassAndHint(VRM.getMachineFunction(), SA.Loops);<br>
+ Edit->calculateRegClassAndHint(VRM.getMachineFunction(), SA.Loops, MBFI);<br>
<br>
assert(!LRMap || LRMap->size() == Edit->size());<br>
}<br>
<br>
Modified: llvm/trunk/lib/CodeGen/SplitKit.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.h?rev=184105&r1=184104&r2=184105&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.h?rev=184105&r1=184104&r2=184105&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/SplitKit.h (original)<br>
+++ llvm/trunk/lib/CodeGen/SplitKit.h Mon Jun 17 14:00:36 2013<br>
@@ -27,6 +27,7 @@ class ConnectedVNInfoEqClasses;<br>
class LiveInterval;<br>
class LiveIntervals;<br>
class LiveRangeEdit;<br>
+class MachineBlockFrequencyInfo;<br>
class MachineInstr;<br>
class MachineLoopInfo;<br>
class MachineRegisterInfo;<br>
@@ -215,6 +216,7 @@ class SplitEditor {<br>
MachineDominatorTree &MDT;<br>
const TargetInstrInfo &TII;<br>
const TargetRegisterInfo &TRI;<br>
+ const MachineBlockFrequencyInfo &MBFI;<br>
<br>
public:<br>
<br>
@@ -349,7 +351,7 @@ public:<br>
/// Create a new SplitEditor for editing the LiveInterval analyzed by SA.<br>
/// Newly created intervals will be appended to newIntervals.<br>
SplitEditor(SplitAnalysis &SA, LiveIntervals&, VirtRegMap&,<br>
- MachineDominatorTree&);<br>
+ MachineDominatorTree&, MachineBlockFrequencyInfo &);<br>
<br>
/// reset - Prepare for a new split.<br>
void reset(LiveRangeEdit&, ComplementSpillMode = SM_Partition);<br>
<br>
Modified: llvm/trunk/lib/CodeGen/StackSlotColoring.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StackSlotColoring.cpp?rev=184105&r1=184104&r2=184105&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StackSlotColoring.cpp?rev=184105&r1=184104&r2=184105&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/StackSlotColoring.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/StackSlotColoring.cpp Mon Jun 17 14:00:36 2013<br>
@@ -19,9 +19,9 @@<br>
#include "llvm/ADT/Statistic.h"<br>
#include "llvm/CodeGen/LiveIntervalAnalysis.h"<br>
#include "llvm/CodeGen/LiveStackAnalysis.h"<br>
+#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"<br>
#include "llvm/CodeGen/MachineFrameInfo.h"<br>
#include "llvm/CodeGen/MachineInstrBuilder.h"<br>
-#include "llvm/CodeGen/MachineLoopInfo.h"<br>
#include "llvm/CodeGen/MachineMemOperand.h"<br>
#include "llvm/CodeGen/MachineRegisterInfo.h"<br>
#include "llvm/CodeGen/PseudoSourceValue.h"<br>
@@ -48,7 +48,7 @@ namespace {<br>
LiveStacks* LS;<br>
MachineFrameInfo *MFI;<br>
const TargetInstrInfo *TII;<br>
- const MachineLoopInfo *loopInfo;<br>
+ const MachineBlockFrequencyInfo *MBFI;<br>
<br>
// SSIntervals - Spill slot intervals.<br>
std::vector<LiveInterval*> SSIntervals;<br>
@@ -89,8 +89,8 @@ namespace {<br>
AU.addRequired<SlotIndexes>();<br>
AU.addPreserved<SlotIndexes>();<br>
AU.addRequired<LiveStacks>();<br>
- AU.addRequired<MachineLoopInfo>();<br>
- AU.addPreserved<MachineLoopInfo>();<br>
+ AU.addRequired<MachineBlockFrequencyInfo>();<br>
+ AU.addPreserved<MachineBlockFrequencyInfo>();<br>
AU.addPreservedID(MachineDominatorsID);<br>
MachineFunctionPass::getAnalysisUsage(AU);<br>
}<br>
@@ -139,7 +139,7 @@ void StackSlotColoring::ScanForSpillSlot<br>
for (MachineFunction::iterator MBBI = MF.begin(), E = MF.end();<br>
MBBI != E; ++MBBI) {<br>
MachineBasicBlock *MBB = &*MBBI;<br>
- unsigned loopDepth = loopInfo->getLoopDepth(MBB);<br>
+ BlockFrequency Freq = MBFI->getBlockFreq(MBB);<br>
for (MachineBasicBlock::iterator MII = MBB->begin(), EE = MBB->end();<br>
MII != EE; ++MII) {<br>
MachineInstr *MI = &*MII;<br>
@@ -154,7 +154,7 @@ void StackSlotColoring::ScanForSpillSlot<br>
continue;<br>
LiveInterval &li = LS->getInterval(FI);<br>
if (!MI->isDebugValue())<br>
- li.weight += LiveIntervals::getSpillWeight(false, true, loopDepth);<br>
+ li.weight += LiveIntervals::getSpillWeight(false, true, Freq);<br>
SSRefs[FI].push_back(MI);<br>
}<br>
}<br>
@@ -396,7 +396,7 @@ bool StackSlotColoring::runOnMachineFunc<br>
MFI = MF.getFrameInfo();<br>
TII = MF.getTarget().getInstrInfo();<br>
LS = &getAnalysis<LiveStacks>();<br>
- loopInfo = &getAnalysis<MachineLoopInfo>();<br>
+ MBFI = &getAnalysis<MachineBlockFrequencyInfo>();<br>
<br>
bool Changed = false;<br>
<br>
<br>
Modified: llvm/trunk/test/CodeGen/ARM/lsr-unfolded-offset.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/lsr-unfolded-offset.ll?rev=184105&r1=184104&r2=184105&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/lsr-unfolded-offset.ll?rev=184105&r1=184104&r2=184105&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/ARM/lsr-unfolded-offset.ll (original)<br>
+++ llvm/trunk/test/CodeGen/ARM/lsr-unfolded-offset.ll Mon Jun 17 14:00:36 2013<br>
@@ -7,8 +7,7 @@<br>
; CHECK: sub sp, #{{40|32|28|24}}<br>
<br>
; CHECK: %for.inc<br>
-; CHECK: ldr{{(.w)?}} r{{.*}}, [sp, #<br>
-; CHECK: ldr{{(.w)?}} r{{.*}}, [sp, #<br>
+; CHECK-NOT: ldr<br>
; CHECK: add<br>
<br>
target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:32:64-v128:32:128-a0:0:32-n32"<br>
<br>
Modified: llvm/trunk/test/CodeGen/SPARC/2011-01-19-DelaySlot.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SPARC/2011-01-19-DelaySlot.ll?rev=184105&r1=184104&r2=184105&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SPARC/2011-01-19-DelaySlot.ll?rev=184105&r1=184104&r2=184105&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/SPARC/2011-01-19-DelaySlot.ll (original)<br>
+++ llvm/trunk/test/CodeGen/SPARC/2011-01-19-DelaySlot.ll Mon Jun 17 14:00:36 2013<br>
@@ -59,7 +59,7 @@ entry:<br>
;CHECK: !NO_APP<br>
;CHECK-NEXT: cmp<br>
;CHECK-NEXT: bg<br>
-;CHECK-NEXT: nop<br>
+;CHECK-NEXT: or<br>
tail call void asm sideeffect "sethi 0, %g0", ""() nounwind<br>
%0 = icmp slt i32 %a, 0<br>
br i1 %0, label %bb, label %bb1<br>
<br>
Removed: llvm/trunk/test/CodeGen/X86/2012-02-20-MachineCPBug.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2012-02-20-MachineCPBug.ll?rev=184104&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2012-02-20-MachineCPBug.ll?rev=184104&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/X86/2012-02-20-MachineCPBug.ll (original)<br>
+++ llvm/trunk/test/CodeGen/X86/2012-02-20-MachineCPBug.ll (removed)<br>
@@ -1,78 +0,0 @@<br>
-; RUN: llc < %s -mtriple=i386-apple-macosx -mcpu=core2 -mattr=+sse | FileCheck %s<br>
-; PR11940: Do not optimize away movb %al, %ch<br>
-<br>
-%struct.APInt = type { i64* }<br>
-<br>
-declare noalias i8* @calloc(i32, i32) nounwind<br>
-<br>
-define void @bug(%struct.APInt* noalias nocapture sret %agg.result, %struct.APInt* nocapture %this, i32 %rotateAmt) nounwind align 2 {<br>
-entry:<br>
-; CHECK: bug:<br>
- %call = tail call i8* @calloc(i32 1, i32 32)<br>
- %call.i = tail call i8* @calloc(i32 1, i32 32) nounwind<br>
- %0 = bitcast i8* %call.i to i64*<br>
- %rem.i = and i32 %rotateAmt, 63<br>
- %div.i = lshr i32 %rotateAmt, 6<br>
- %cmp.i = icmp eq i32 %rem.i, 0<br>
- br i1 %cmp.i, label %for.cond.preheader.i, label %if.end.i<br>
-<br>
-for.cond.preheader.i: ; preds = %entry<br>
- %sub.i = sub i32 4, %div.i<br>
- %cmp23.i = icmp eq i32 %div.i, 4<br>
- br i1 %cmp23.i, label %for.body9.lr.ph.i, label %for.body.lr.ph.i<br>
-<br>
-for.body.lr.ph.i: ; preds = %for.cond.preheader.i<br>
- %pVal.i = getelementptr inbounds %struct.APInt* %this, i32 0, i32 0<br>
- %.pre5.i = load i64** %pVal.i, align 4<br>
- br label %for.body.i<br>
-<br>
-for.body.i: ; preds = %for.body.i, %for.body.lr.ph.i<br>
- %i.04.i = phi i32 [ 0, %for.body.lr.ph.i ], [ %inc.i, %for.body.i ]<br>
- %add.i = add i32 %i.04.i, %div.i<br>
- %arrayidx.i = getelementptr inbounds i64* %.pre5.i, i32 %add.i<br>
- %1 = load i64* %arrayidx.i, align 4<br>
- %arrayidx3.i = getelementptr inbounds i64* %0, i32 %i.04.i<br>
- store i64 %1, i64* %arrayidx3.i, align 4<br>
- %inc.i = add i32 %i.04.i, 1<br>
- %cmp2.i = icmp ult i32 %inc.i, %sub.i<br>
- br i1 %cmp2.i, label %for.body.i, label %if.end.i<br>
-<br>
-if.end.i: ; preds = %for.body.i, %entry<br>
- %cmp81.i = icmp eq i32 %div.i, 3<br>
- br i1 %cmp81.i, label %_ZNK5APInt4lshrEj.exit, label %for.body9.lr.ph.i<br>
-<br>
-for.body9.lr.ph.i: ; preds = %if.end.i, %for.cond.preheader.i<br>
- %sub58.i = sub i32 3, %div.i<br>
- %pVal11.i = getelementptr inbounds %struct.APInt* %this, i32 0, i32 0<br>
- %sh_prom.i = zext i32 %rem.i to i64<br>
- %sub17.i = sub i32 64, %rem.i<br>
- %sh_prom18.i = zext i32 %sub17.i to i64<br>
- %.pre.i = load i64** %pVal11.i, align 4<br>
- br label %for.body9.i<br>
-<br>
-for.body9.i: ; preds = %for.body9.i, %for.body9.lr.ph.i<br>
-; CHECK: %for.body9.i<br>
-; CHECK: movb<br>
-; CHECK: shrdl<br>
- %i6.02.i = phi i32 [ 0, %for.body9.lr.ph.i ], [ %inc21.i, %for.body9.i ]<br>
- %add10.i = add i32 %i6.02.i, %div.i<br>
- %arrayidx12.i = getelementptr inbounds i64* %.pre.i, i32 %add10.i<br>
- %2 = load i64* %arrayidx12.i, align 4<br>
- %shr.i = lshr i64 %2, %sh_prom.i<br>
- %add14.i = add i32 %add10.i, 1<br>
- %arrayidx16.i = getelementptr inbounds i64* %.pre.i, i32 %add14.i<br>
- %3 = load i64* %arrayidx16.i, align 4<br>
- %shl.i = shl i64 %3, %sh_prom18.i<br>
- %or.i = or i64 %shl.i, %shr.i<br>
- %arrayidx19.i = getelementptr inbounds i64* %0, i32 %i6.02.i<br>
- store i64 %or.i, i64* %arrayidx19.i, align 4<br>
- %inc21.i = add i32 %i6.02.i, 1<br>
- %cmp8.i = icmp ult i32 %inc21.i, %sub58.i<br>
- br i1 %cmp8.i, label %for.body9.i, label %_ZNK5APInt4lshrEj.exit<br>
-<br>
-_ZNK5APInt4lshrEj.exit: ; preds = %for.body9.i, %if.end.i<br>
- %call.i1 = tail call i8* @calloc(i32 1, i32 32) nounwind<br>
- %4 = getelementptr inbounds %struct.APInt* %agg.result, i32 0, i32 0<br>
- store i64* %0, i64** %4, align 4<br>
- ret void<br>
-}<br>
<br>
Modified: llvm/trunk/test/CodeGen/X86/atom-bypass-slow-division-64.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/atom-bypass-slow-division-64.ll?rev=184105&r1=184104&r2=184105&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/atom-bypass-slow-division-64.ll?rev=184105&r1=184104&r2=184105&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/X86/atom-bypass-slow-division-64.ll (original)<br>
+++ llvm/trunk/test/CodeGen/X86/atom-bypass-slow-division-64.ll Mon Jun 17 14:00:36 2013<br>
@@ -4,8 +4,9 @@<br>
<br>
define i64 @Test_get_quotient(i64 %a, i64 %b) nounwind {<br>
; CHECK: Test_get_quotient:<br>
-; CHECK: orq %rsi, %rcx<br>
-; CHECK-NEXT: testq $-65536, %rcx<br>
+; CHECK: movq %rdi, %rax<br>
+; CHECK: orq %rsi, %rax<br>
+; CHECK-NEXT: testq $-65536, %rax<br>
; CHECK-NEXT: je<br>
; CHECK: idivq<br>
; CHECK: ret<br>
@@ -17,8 +18,9 @@ define i64 @Test_get_quotient(i64 %a, i6<br>
<br>
define i64 @Test_get_remainder(i64 %a, i64 %b) nounwind {<br>
; CHECK: Test_get_remainder:<br>
-; CHECK: orq %rsi, %rcx<br>
-; CHECK-NEXT: testq $-65536, %rcx<br>
+; CHECK: movq %rdi, %rax<br>
+; CHECK: orq %rsi, %rax<br>
+; CHECK-NEXT: testq $-65536, %rax<br>
; CHECK-NEXT: je<br>
; CHECK: idivq<br>
; CHECK: ret<br>
@@ -30,8 +32,9 @@ define i64 @Test_get_remainder(i64 %a, i<br>
<br>
define i64 @Test_get_quotient_and_remainder(i64 %a, i64 %b) nounwind {<br>
; CHECK: Test_get_quotient_and_remainder:<br>
-; CHECK: orq %rsi, %rcx<br>
-; CHECK-NEXT: testq $-65536, %rcx<br>
+; CHECK: movq %rdi, %rax<br>
+; CHECK: orq %rsi, %rax<br>
+; CHECK-NEXT: testq $-65536, %rax<br>
; CHECK-NEXT: je<br>
; CHECK: idivq<br>
; CHECK: divw<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>