<div dir="ltr">Hi Wei,<div><br></div><div>I am still seeing failures on the buildbots: <a href="http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_build/">http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_build/</a> , but you're right the code looks ok to me. Quentin, Chris - could this be a builder config issue?</div><div><br></div><div>- Lang.</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jul 9, 2016 at 11:05 AM, Wei Mi <span dir="ltr"><<a href="mailto:wmi@google.com" target="_blank">wmi@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Lang,<br>
<br>
Sorry, I am little confused. I check the program and cannot see any<br>
discrepancy reported in the error log, and I also cannot reproduce the<br>
error in clang bootstrap build. Is it anything related with<br>
incremental build?<br>
<br>
Thanks,<br>
Wei.<br>
<div class="HOEnZb"><div class="h5"><br>
On Sat, Jul 9, 2016 at 9:28 AM, Wei Mi <<a href="mailto:wmi@google.com">wmi@google.com</a>> wrote:<br>
> Sorry, I will fix it.<br>
><br>
> Thanks,<br>
> Wei.<br>
><br>
> On Sat, Jul 9, 2016 at 9:03 AM, Lang Hames <<a href="mailto:lhames@gmail.com">lhames@gmail.com</a>> wrote:<br>
>> Hi Wei,<br>
>><br>
>> This appears to have broken the bots:<br>
>> <a href="http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_build/27331/" rel="noreferrer" target="_blank">http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_build/27331/</a><br>
>><br>
>> Could you please fix or revert?<br>
>><br>
>> Cheers,<br>
>> Lang.<br>
>><br>
>><br>
>> On Fri, Jul 8, 2016 at 2:08 PM, Wei Mi via llvm-commits<br>
>> <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br>
>>><br>
>>> Author: wmi<br>
>>> Date: Fri Jul 8 16:08:09 2016<br>
>>> New Revision: 274928<br>
>>><br>
>>> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=274928&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=274928&view=rev</a><br>
>>> Log:<br>
>>> Allow dead insts to be kept in DeadRemat only when they are<br>
>>> rematerializable.<br>
>>><br>
>>> Because isReallyTriviallyReMaterializableGeneric puts many limits on<br>
>>> rematerializable instructions, this fix can prevent instructions with<br>
>>> tied virtual operands and instructions with virtual register uses from<br>
>>> being kept in DeadRemat, so as to workaround the live interval consistency<br>
>>> problem for the dummy instructions kept in DeadRemat.<br>
>>><br>
>>> But we still need to fix the live interval consistency problem. This patch<br>
>>> is just a short time relieve. PR28464 has been filed as a reminder.<br>
>>><br>
>>> Differential Revision: <a href="http://reviews.llvm.org/D19486" rel="noreferrer" target="_blank">http://reviews.llvm.org/D19486</a><br>
>>><br>
>>> Modified:<br>
>>> llvm/trunk/include/llvm/CodeGen/LiveRangeEdit.h<br>
>>> llvm/trunk/lib/CodeGen/InlineSpiller.cpp<br>
>>> llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp<br>
>>> llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp<br>
>>> llvm/trunk/lib/CodeGen/SplitKit.cpp<br>
>>> llvm/trunk/lib/CodeGen/SplitKit.h<br>
>>><br>
>>> Modified: llvm/trunk/include/llvm/CodeGen/LiveRangeEdit.h<br>
>>> URL:<br>
>>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveRangeEdit.h?rev=274928&r1=274927&r2=274928&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveRangeEdit.h?rev=274928&r1=274927&r2=274928&view=diff</a><br>
>>><br>
>>> ==============================================================================<br>
>>> --- llvm/trunk/include/llvm/CodeGen/LiveRangeEdit.h (original)<br>
>>> +++ llvm/trunk/include/llvm/CodeGen/LiveRangeEdit.h Fri Jul 8 16:08:09<br>
>>> 2016<br>
>>> @@ -100,7 +100,8 @@ private:<br>
>>> SmallVector<LiveInterval*, 8>,<br>
>>> SmallPtrSet<LiveInterval*, 8> > ToShrinkSet;<br>
>>> /// Helper for eliminateDeadDefs.<br>
>>> - void eliminateDeadDef(MachineInstr *MI, ToShrinkSet &ToShrink);<br>
>>> + void eliminateDeadDef(MachineInstr *MI, ToShrinkSet &ToShrink,<br>
>>> + AliasAnalysis *AA);<br>
>>><br>
>>> /// MachineRegisterInfo callback to notify when new virtual<br>
>>> /// registers are created.<br>
>>> @@ -242,7 +243,8 @@ public:<br>
>>> /// allocator. These registers should not be split into new intervals<br>
>>> /// as currently those new intervals are not guaranteed to spill.<br>
>>> void eliminateDeadDefs(SmallVectorImpl<MachineInstr *> &Dead,<br>
>>> - ArrayRef<unsigned> RegsBeingSpilled = None);<br>
>>> + ArrayRef<unsigned> RegsBeingSpilled = None,<br>
>>> + AliasAnalysis *AA = nullptr);<br>
>>><br>
>>> /// calculateRegClassAndHint - Recompute register class and hint for<br>
>>> each new<br>
>>> /// register.<br>
>>><br>
>>> Modified: llvm/trunk/lib/CodeGen/InlineSpiller.cpp<br>
>>> URL:<br>
>>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/InlineSpiller.cpp?rev=274928&r1=274927&r2=274928&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/InlineSpiller.cpp?rev=274928&r1=274927&r2=274928&view=diff</a><br>
>>><br>
>>> ==============================================================================<br>
>>> --- llvm/trunk/lib/CodeGen/InlineSpiller.cpp (original)<br>
>>> +++ llvm/trunk/lib/CodeGen/InlineSpiller.cpp Fri Jul 8 16:08:09 2016<br>
>>> @@ -626,7 +626,7 @@ void InlineSpiller::reMaterializeAll() {<br>
>>> if (DeadDefs.empty())<br>
>>> return;<br>
>>> DEBUG(dbgs() << "Remat created " << DeadDefs.size() << " dead<br>
>>> defs.\n");<br>
>>> - Edit->eliminateDeadDefs(DeadDefs, RegsToSpill);<br>
>>> + Edit->eliminateDeadDefs(DeadDefs, RegsToSpill, AA);<br>
>>><br>
>>> // LiveRangeEdit::eliminateDeadDef is used to remove dead define<br>
>>> instructions<br>
>>> // after rematerialization. To remove a VNI for a vreg from its<br>
>>> LiveInterval,<br>
>>> @@ -996,7 +996,7 @@ void InlineSpiller::spillAll() {<br>
>>> // Hoisted spills may cause dead code.<br>
>>> if (!DeadDefs.empty()) {<br>
>>> DEBUG(dbgs() << "Eliminating " << DeadDefs.size() << " dead defs\n");<br>
>>> - Edit->eliminateDeadDefs(DeadDefs, RegsToSpill);<br>
>>> + Edit->eliminateDeadDefs(DeadDefs, RegsToSpill, AA);<br>
>>> }<br>
>>><br>
>>> // Finally delete the SnippetCopies.<br>
>>> @@ -1440,7 +1440,7 @@ void HoistSpillHelper::hoistAllSpills()<br>
>>> RMEnt->RemoveOperand(i - 1);<br>
>>> }<br>
>>> }<br>
>>> - Edit.eliminateDeadDefs(SpillsToRm, None);<br>
>>> + Edit.eliminateDeadDefs(SpillsToRm, None, AA);<br>
>>> }<br>
>>> }<br>
>>><br>
>>><br>
>>> Modified: llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp<br>
>>> URL:<br>
>>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp?rev=274928&r1=274927&r2=274928&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp?rev=274928&r1=274927&r2=274928&view=diff</a><br>
>>><br>
>>> ==============================================================================<br>
>>> --- llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp (original)<br>
>>> +++ llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp Fri Jul 8 16:08:09 2016<br>
>>> @@ -234,7 +234,8 @@ bool LiveRangeEdit::useIsKill(const Live<br>
>>> }<br>
>>><br>
>>> /// Find all live intervals that need to shrink, then remove the<br>
>>> instruction.<br>
>>> -void LiveRangeEdit::eliminateDeadDef(MachineInstr *MI, ToShrinkSet<br>
>>> &ToShrink) {<br>
>>> +void LiveRangeEdit::eliminateDeadDef(MachineInstr *MI, ToShrinkSet<br>
>>> &ToShrink,<br>
>>> + AliasAnalysis *AA) {<br>
>>> assert(MI->allDefsAreDead() && "Def isn't really dead");<br>
>>> SlotIndex Idx = LIS.getInstructionIndex(*MI).getRegSlot();<br>
>>><br>
>>> @@ -327,11 +328,12 @@ void LiveRangeEdit::eliminateDeadDef(Mac<br>
>>> }<br>
>>> DEBUG(dbgs() << "Converted physregs to:\t" << *MI);<br>
>>> } else {<br>
>>> - // If the dest of MI is an original reg, don't delete the inst.<br>
>>> Replace<br>
>>> - // the dest with a new reg, keep the inst for remat of other<br>
>>> siblings.<br>
>>> - // The inst is saved in LiveRangeEdit::DeadRemats and will be deleted<br>
>>> - // after all the allocations of the func are done.<br>
>>> - if (isOrigDef) {<br>
>>> + // If the dest of MI is an original reg and MI is reMaterializable,<br>
>>> + // don't delete the inst. Replace the dest with a new reg, and keep<br>
>>> + // the inst for remat of other siblings. The inst is saved in<br>
>>> + // LiveRangeEdit::DeadRemats and will be deleted after all the<br>
>>> + // allocations of the func are done.<br>
>>> + if (isOrigDef && DeadRemats && TII.isTriviallyReMaterializable(*MI,<br>
>>> AA)) {<br>
>>> LiveInterval &NewLI = createEmptyIntervalFrom(Dest);<br>
>>> VNInfo *VNI = NewLI.getNextValue(Idx, LIS.getVNInfoAllocator());<br>
>>> NewLI.addSegment(LiveInterval::Segment(Idx, Idx.getDeadSlot(),<br>
>>> VNI));<br>
>>> @@ -361,13 +363,14 @@ void LiveRangeEdit::eliminateDeadDef(Mac<br>
>>> }<br>
>>><br>
>>> void LiveRangeEdit::eliminateDeadDefs(SmallVectorImpl<MachineInstr *><br>
>>> &Dead,<br>
>>> - ArrayRef<unsigned><br>
>>> RegsBeingSpilled) {<br>
>>> + ArrayRef<unsigned><br>
>>> RegsBeingSpilled,<br>
>>> + AliasAnalysis *AA) {<br>
>>> ToShrinkSet ToShrink;<br>
>>><br>
>>> for (;;) {<br>
>>> // Erase all dead defs.<br>
>>> while (!Dead.empty())<br>
>>> - eliminateDeadDef(Dead.pop_back_val(), ToShrink);<br>
>>> + eliminateDeadDef(Dead.pop_back_val(), ToShrink, AA);<br>
>>><br>
>>> if (ToShrink.empty())<br>
>>> break;<br>
>>><br>
>>> Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp<br>
>>> URL:<br>
>>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp?rev=274928&r1=274927&r2=274928&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp?rev=274928&r1=274927&r2=274928&view=diff</a><br>
>>><br>
>>> ==============================================================================<br>
>>> --- llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp (original)<br>
>>> +++ llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Fri Jul 8 16:08:09 2016<br>
>>> @@ -129,6 +129,7 @@ class RAGreedy : public MachineFunctionP<br>
>>> EdgeBundles *Bundles;<br>
>>> SpillPlacement *SpillPlacer;<br>
>>> LiveDebugVariables *DebugVars;<br>
>>> + AliasAnalysis *AA;<br>
>>><br>
>>> // state<br>
>>> std::unique_ptr<Spiller> SpillerInstance;<br>
>>> @@ -2592,6 +2593,7 @@ bool RAGreedy::runOnMachineFunction(Mach<br>
>>> Bundles = &getAnalysis<EdgeBundles>();<br>
>>> SpillPlacer = &getAnalysis<SpillPlacement>();<br>
>>> DebugVars = &getAnalysis<LiveDebugVariables>();<br>
>>> + AA = &getAnalysis<AAResultsWrapperPass>().getAAResults();<br>
>>><br>
>>> initializeCSRCost();<br>
>>><br>
>>> @@ -2600,7 +2602,7 @@ bool RAGreedy::runOnMachineFunction(Mach<br>
>>> DEBUG(LIS->dump());<br>
>>><br>
>>> SA.reset(new SplitAnalysis(*VRM, *LIS, *Loops));<br>
>>> - SE.reset(new SplitEditor(*SA, *LIS, *VRM, *DomTree, *MBFI));<br>
>>> + SE.reset(new SplitEditor(*SA, *AA, *LIS, *VRM, *DomTree, *MBFI));<br>
>>> ExtraRegInfo.clear();<br>
>>> ExtraRegInfo.resize(MRI->getNumVirtRegs());<br>
>>> NextCascade = 1;<br>
>>><br>
>>> Modified: llvm/trunk/lib/CodeGen/SplitKit.cpp<br>
>>> URL:<br>
>>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.cpp?rev=274928&r1=274927&r2=274928&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.cpp?rev=274928&r1=274927&r2=274928&view=diff</a><br>
>>><br>
>>> ==============================================================================<br>
>>> --- llvm/trunk/lib/CodeGen/SplitKit.cpp (original)<br>
>>> +++ llvm/trunk/lib/CodeGen/SplitKit.cpp Fri Jul 8 16:08:09 2016<br>
>>> @@ -338,11 +338,13 @@ void SplitAnalysis::analyze(const LiveIn<br>
>>><br>
>>> //===----------------------------------------------------------------------===//<br>
>>><br>
>>> /// Create a new SplitEditor for editing the LiveInterval analyzed by SA.<br>
>>> -SplitEditor::SplitEditor(SplitAnalysis &sa, LiveIntervals &lis,<br>
>>> VirtRegMap &vrm,<br>
>>> +SplitEditor::SplitEditor(SplitAnalysis &sa, AliasAnalysis &aa,<br>
>>> + LiveIntervals &lis, VirtRegMap &vrm,<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().getSubtarget().getInstrInfo()),<br>
>>> + : SA(sa), AA(aa), LIS(lis), VRM(vrm),<br>
>>> + MRI(vrm.getMachineFunction().getRegInfo()), MDT(mdt),<br>
>>> + TII(*vrm.getMachineFunction().getSubtarget().getInstrInfo()),<br>
>>> TRI(*vrm.getMachineFunction().getSubtarget().getRegisterInfo()),<br>
>>> MBFI(mbfi), Edit(nullptr), OpenIdx(0), SpillMode(SM_Partition),<br>
>>> RegAssign(Allocator) {}<br>
>>> @@ -1130,7 +1132,7 @@ void SplitEditor::deleteRematVictims() {<br>
>>> if (Dead.empty())<br>
>>> return;<br>
>>><br>
>>> - Edit->eliminateDeadDefs(Dead);<br>
>>> + Edit->eliminateDeadDefs(Dead, None, &AA);<br>
>>> }<br>
>>><br>
>>> void SplitEditor::finish(SmallVectorImpl<unsigned> *LRMap) {<br>
>>><br>
>>> Modified: llvm/trunk/lib/CodeGen/SplitKit.h<br>
>>> URL:<br>
>>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.h?rev=274928&r1=274927&r2=274928&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.h?rev=274928&r1=274927&r2=274928&view=diff</a><br>
>>><br>
>>> ==============================================================================<br>
>>> --- llvm/trunk/lib/CodeGen/SplitKit.h (original)<br>
>>> +++ llvm/trunk/lib/CodeGen/SplitKit.h Fri Jul 8 16:08:09 2016<br>
>>> @@ -235,6 +235,7 @@ public:<br>
>>> ///<br>
>>> class LLVM_LIBRARY_VISIBILITY SplitEditor {<br>
>>> SplitAnalysis &SA;<br>
>>> + AliasAnalysis &AA;<br>
>>> LiveIntervals &LIS;<br>
>>> VirtRegMap &VRM;<br>
>>> MachineRegisterInfo &MRI;<br>
>>> @@ -380,8 +381,9 @@ private:<br>
>>> public:<br>
>>> /// Create a new SplitEditor for editing the LiveInterval analyzed by<br>
>>> SA.<br>
>>> /// Newly created intervals will be appended to newIntervals.<br>
>>> - SplitEditor(SplitAnalysis &SA, LiveIntervals&, VirtRegMap&,<br>
>>> - MachineDominatorTree&, MachineBlockFrequencyInfo &);<br>
>>> + SplitEditor(SplitAnalysis &SA, AliasAnalysis &AA, LiveIntervals&,<br>
>>> + VirtRegMap&, MachineDominatorTree&,<br>
>>> + MachineBlockFrequencyInfo &);<br>
>>><br>
>>> /// reset - Prepare for a new split.<br>
>>> void reset(LiveRangeEdit&, ComplementSpillMode = SM_Partition);<br>
>>><br>
>>><br>
>>> _______________________________________________<br>
>>> llvm-commits mailing list<br>
>>> <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
>>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
>><br>
>><br>
</div></div></blockquote></div><br></div>