[llvm-commits] [llvm] r132806 - /llvm/trunk/lib/CodeGen/TailDuplication.cpp

Rafael Avila de Espindola rafael.espindola at gmail.com
Fri Jun 10 13:15:10 PDT 2011


> Maybe it would be better to call AnalyzeBranch with
> AllowModify=false?  At least for the early tail-dup pass, I don't see
> why this code needs to let AnalyzeBranch modify the code.  I doubt if
> the late tail-dup pass benefits much, either.

I considered that, but since it is removing some branches, I decided to 
fix the problem with as little change to the produced code as possible 
while benchmarking it.

> One more comment below....


>> MachineBasicBlock *PredTBB, *PredFBB; SmallVector<MachineOperand,
>> 4>  PredCond; +    // EH edges are ignored by AnalyzeBranch. +
>> if (PredBB->succ_size() != 1) +      continue; if
>> (TII->AnalyzeBranch(*PredBB, PredTBB, PredFBB, PredCond, true))
>> continue; if (!PredCond.empty()) continue; -    // EH edges are
>> ignored by AnalyzeBranch. -    if (PredBB->succ_size() != 1) -
>> continue; // Don't duplicate into a fall-through predecessor (at
>> least for now). if (PredBB->isLayoutSuccessor(TailBB)&&
>> PredBB->canFallThrough()) continue;
>
> This is fine, but I think you can remove that check altogether.  Just
> a few lines above, we have:
>
> assert(TailBB != PredBB&& "Single-block loop should have been
> rejected earlier!"); if (PredBB->succ_size()>  1) continue;
>

Fixed!

Thanks,
Rafael



More information about the llvm-commits mailing list