[llvm] r188874 - MC CFG: Don't insert preds/succs again.

David Blaikie dblaikie at gmail.com
Wed Aug 21 10:17:21 PDT 2013


On Wed, Aug 21, 2013 at 12:27 AM, Ahmed Bougacha
<ahmed.bougacha at gmail.com> wrote:
> Author: ab
> Date: Wed Aug 21 02:27:50 2013
> New Revision: 188874
>
> URL: http://llvm.org/viewvc/llvm-project?rev=188874&view=rev
> Log:
> MC CFG: Don't insert preds/succs again.

If this produced essentially dead tests in existing code, I'd
generally prefer it to go in with the code that causes both true &
false paths through the 'if' to be reachable (with test cases that
actually traverse both paths). ie: this is possibly /too/ fine
grained. When someone goes to look at why this change was added, it'll
be hard to find the motivation, because it was added in isolation - so
they might be more likely to remove it without the evidence for why it
was necessary, only to have to learn the lesson again that should've
been made clear by the code/commit history.

>
> Modified:
>     llvm/trunk/lib/MC/MCFunction.cpp
>
> Modified: llvm/trunk/lib/MC/MCFunction.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCFunction.cpp?rev=188874&r1=188873&r2=188874&view=diff
> ==============================================================================
> --- llvm/trunk/lib/MC/MCFunction.cpp (original)
> +++ llvm/trunk/lib/MC/MCFunction.cpp Wed Aug 21 02:27:50 2013
> @@ -37,7 +37,8 @@ MCBasicBlock::MCBasicBlock(const MCTextA
>  {}
>
>  void MCBasicBlock::addSuccessor(const MCBasicBlock *MCBB) {
> -  Successors.push_back(MCBB);
> +  if (!isSuccessor(MCBB))
> +    Successors.push_back(MCBB);
>  }
>
>  bool MCBasicBlock::isSuccessor(const MCBasicBlock *MCBB) const {
> @@ -46,7 +47,8 @@ bool MCBasicBlock::isSuccessor(const MCB
>  }
>
>  void MCBasicBlock::addPredecessor(const MCBasicBlock *MCBB) {
> -  Predecessors.push_back(MCBB);
> +  if (!isPredecessor(MCBB))
> +    Predecessors.push_back(MCBB);
>  }
>
>  bool MCBasicBlock::isPredecessor(const MCBasicBlock *MCBB) const {
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list