Reapply 254950 w/fix
authorPhilip Reames <listmail@philipreames.com>
Mon, 7 Dec 2015 22:41:23 +0000 (22:41 +0000)
committerPhilip Reames <listmail@philipreames.com>
Mon, 7 Dec 2015 22:41:23 +0000 (22:41 +0000)
commit0890b95b60c353074d8d3a2e11906e66282e30da
tree7aee8d516ab23fb90949d1036dd2de3e6aac2105
parent3ff1b160f82fb7887a77f41d5c1f47d9e9126af9
Reapply 254950 w/fix

254950 ended up being not NFC.  The previous code was overriding the flags for whether an instruction read or wrote memory using the target specific flags returned via TTI.  I'd missed this in my refactoring.  Since I mistakenly built only x86 and didn't notice the number of unsupported tests, I didn't catch that before the original checkin.

This raises an interesting issue though.  Given we have function attributes (i.e. readonly, readnone, argmemonly) which describe the aliasing of intrinsics, why does TTI have this information overriding the instruction definition at all?  I see no reason for this, but decided to preserve existing behavior for the moment.  The root issue might be that we don't have a "writeonly" attribute.

Original commit message:
[EarlyCSE] Simplify and invert ParseMemoryInst [NFCI]

Restructure ParseMemoryInst - which was introduced to abstract over target specific load and stores instructions - to just query the underlying instructions. In theory, this could be slightly slower than caching the results, but in practice, it's very unlikely to be measurable.

The simple query scheme makes it far easier to understand, and much easier to extend with new queries. Given I'm about to need to add new query types, doing the cleanup first seemed worthwhile.

Do we still believe the target specific intrinsic handling is worthwhile in EarlyCSE? It adds quite a bit of complexity and makes the code harder to read. Being able to delete the abstraction entirely would be wonderful.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254957 91177308-0d34-0410-b5e6-96231b3b80d8
lib/IR/LegacyPassManager.cpp
lib/Transforms/Scalar/EarlyCSE.cpp