Add ptr-eq short-cut to `compareByteArrays#` primitive
authorHerbert Valerio Riedel <hvr@gnu.org>
Fri, 26 Jan 2018 18:07:17 +0000 (13:07 -0500)
committerBen Gamari <ben@smart-cactus.org>
Mon, 29 Jan 2018 21:20:01 +0000 (16:20 -0500)
commit309d632c7147b65b9ae017f08d65295e8b1fdbcb
treed9288b5b826e85f5ec1b9f538c7c48fd4ed2b134
parentf60ae5acf908cd1da73ec3b505377ba6801bf6ec
Add ptr-eq short-cut to `compareByteArrays#` primitive

This is an obvious optimisation whose overhead is neglectable but
which significantly simplifies the common uses of `compareByteArrays#`
which would otherwise require to make *careful* use of
`reallyUnsafePtrEquality#` or (equally fragile) `byteArrayContents#`
which can result in less optimal assembler code being generated.

Test Plan: carefully examined generated cmm/asm code; validate via phab

Reviewers: alexbiehl, bgamari, simonmar

Reviewed By: bgamari, simonmar

Subscribers: rwbarton, thomie, carter

Differential Revision: https://phabricator.haskell.org/D4319

(cherry picked from commit 31c260f3967d2c06063c962a98475058daa45c6d)
compiler/codeGen/StgCmmPrim.hs