[llvm-commits] [llvm] r51636 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/memmove.ll

Andrew Lenharth andrewl at lenharth.org
Thu May 29 08:55:39 PDT 2008


What about when the memmove would segfault (due to a large size)?  Is
this allowed then?

On Wed, May 28, 2008 at 12:30 AM, Chris Lattner <sabre at nondot.org> wrote:
> Author: lattner
> Date: Wed May 28 00:30:41 2008
> New Revision: 51636
>
> URL: http://llvm.org/viewvc/llvm-project?rev=51636&view=rev
> Log:
> Implement PR2370: memmove(x,x,size) -> noop.
>
>
> Modified:
>    llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
>    llvm/trunk/test/Transforms/InstCombine/memmove.ll
>
> Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=51636&r1=51635&r2=51636&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Wed May 28 00:30:41 2008
> @@ -9131,6 +9131,10 @@
>           CI.setOperand(0, Intrinsic::getDeclaration(M, MemCpyID));
>           Changed = true;
>         }
> +
> +      // memmove(x,x,size) -> noop.
> +      if (MMI->getSource() == MMI->getDest())
> +        return EraseInstFromFunction(CI);
>     }
>
>     // If we can determine a pointer alignment that is bigger than currently
>
> Modified: llvm/trunk/test/Transforms/InstCombine/memmove.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/memmove.ll?rev=51636&r1=51635&r2=51636&view=diff
>
> ==============================================================================
> --- llvm/trunk/test/Transforms/InstCombine/memmove.ll (original)
> +++ llvm/trunk/test/Transforms/InstCombine/memmove.ll Wed May 28 00:30:41 2008
> @@ -34,3 +34,9 @@
>        ret i32 0
>  }
>
> +; PR2370
> +define void @test4(i8* %a) {
> +        tail call void @llvm.memmove.i32( i8* %a, i8* %a, i32 100, i32 1 )
> +        ret void
> +}
> +
>
>
> _______________________________________________
> 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