]> granicus.if.org Git - llvm/commit
[Hexagon] Generate correct runtime check when recognizing memmove
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>
Thu, 24 Aug 2017 11:59:53 +0000 (11:59 +0000)
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>
Thu, 24 Aug 2017 11:59:53 +0000 (11:59 +0000)
commit3dfcd099f58850219da953c1245b46ec2564311c
tree9987f2f6409edcbc1674569a01ddcb7cb8f896aa
parent6e59618ef939347c31fe79437278383ea46ced7d
[Hexagon] Generate correct runtime check when recognizing memmove

The check (assuming positive stride) for validity of memmove should be
(a) the destination is at a lower address than the source, or
(b) the distance between the source and destination is greater than or
    equal the number of bytes copied.

For the second part it is sufficient to assume that the destination
is at a higher address, since the opposite case is covered by (a).
The distance calculation was previously done by subtracting the
pointers in the wrong order.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311650 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp
test/CodeGen/Hexagon/loop-idiom/memmove-rt-check.ll [new file with mode: 0644]