Re-land "[CodeGen][ExpandMemcmp][NFC] Allow memcmp to expand to vector loads (1)"
authorClement Courbet <courbet@google.com>
Wed, 25 Oct 2017 11:02:09 +0000 (11:02 +0000)
committerClement Courbet <courbet@google.com>
Wed, 25 Oct 2017 11:02:09 +0000 (11:02 +0000)
commit0c7cd071f7916a4f9a0bdc70a58b8477c3700e38
treef2966684fbc6334a3976f6b73b960883d34ee0e6
parent0be860f695e30b227e3358c182dd367026e6c91c
Re-land "[CodeGen][ExpandMemcmp][NFC] Allow memcmp to expand to vector loads (1)"

Compute the actual decomposition only after deciding whether to expand
of not. Else, it's easy to make the compiler OOM with:
`memcpy(dst, src, 0xffffffffffffffff);`, which typically happens if
someone mistakenly passes a negative value. Add a test.

This reverts commit f8fc02fbd4ab33383c010d33675acf9763d0bd44.

llvm-svn: 316567
llvm/lib/CodeGen/CodeGenPrepare.cpp
llvm/test/CodeGen/X86/memcmp.ll