[llvm] r353038 - [NFC] Make a check in GuardWidening more obvious
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 4 11:22:01 PST 2019
Max,
I don't think this has exactly the effect you indended. It doesn't
break anything, but it does slow down the code. The purpose of the
original terminator check was to avoid doing the extra work when the
guard was the terminator.
In fact, the whole find is overkill. You should be able to use
getIterator on the Instruction.
Would you mind making that simplification, and removing the isGuard
check entirely?
Philip
On 2/4/19 2:41 AM, Max Kazantsev via llvm-commits wrote:
> Author: mkazantsev
> Date: Mon Feb 4 02:41:17 2019
> New Revision: 353038
>
> URL: http://llvm.org/viewvc/llvm-project?rev=353038&view=rev
> Log:
> [NFC] Make a check in GuardWidening more obvious
>
> Modified:
> llvm/trunk/lib/Transforms/Scalar/GuardWidening.cpp
>
> Modified: llvm/trunk/lib/Transforms/Scalar/GuardWidening.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GuardWidening.cpp?rev=353038&r1=353037&r2=353038&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/GuardWidening.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/GuardWidening.cpp Mon Feb 4 02:41:17 2019
> @@ -375,7 +375,7 @@ bool GuardWideningImpl::eliminateInstrVi
>
> assert((i == (e - 1)) == (Instr->getParent() == CurBB) && "Bad DFS?");
>
> - if (Instr->getParent() == CurBB && CurBB->getTerminator() != Instr) {
> + if (Instr->getParent() == CurBB && isGuard(Instr)) {
> // Corner case: make sure we're only looking at guards strictly dominating
> // GuardInst when visiting GuardInst->getParent().
> auto NewEnd = std::find(I, E, Instr);
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list