[llvm-commits] [llvm] r132806 - /llvm/trunk/lib/CodeGen/TailDuplication.cpp
Bob Wilson
bob.wilson at apple.com
Fri Jun 10 12:06:45 PDT 2011
On Jun 9, 2011, at 2:43 PM, Rafael Espindola wrote:
> Author: rafael
> Date: Thu Jun 9 16:43:25 2011
> New Revision: 132806
>
> URL: http://llvm.org/viewvc/llvm-project?rev=132806&view=rev
> Log:
> AnalyzeBranch modifies the bb, but we don't want to modify a bb with
> eh edges. Swap the order of the checks to avoid it.
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.
One more comment below....
>
> Modified:
> llvm/trunk/lib/CodeGen/TailDuplication.cpp
>
> Modified: llvm/trunk/lib/CodeGen/TailDuplication.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TailDuplication.cpp?rev=132806&r1=132805&r2=132806&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/TailDuplication.cpp (original)
> +++ llvm/trunk/lib/CodeGen/TailDuplication.cpp Thu Jun 9 16:43:25 2011
> @@ -541,13 +541,13 @@
>
> 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;
More information about the llvm-commits
mailing list