Use the target-aware constant folder on expressions to improve the chance
authorNick Lewycky <nicholas@mxc.ca>
Tue, 21 Feb 2012 22:08:06 +0000 (22:08 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Tue, 21 Feb 2012 22:08:06 +0000 (22:08 +0000)
commita641c07828fe4e836d680b9e8b0b4af3204b8b97
tree476b174150c55bfa16af796808c71dd4a2554dd0
parent07043279f60622243d16d8a3f60805960482083c
Use the target-aware constant folder on expressions to improve the chance
they'll be simple enough to simulate, and to reduce the chance we'll encounter
equal but different simple pointer constants.

This removes the symptoms from PR11352 but is not a full fix. A proper fix would
either require a guarantee that two constant objects we simulate are folded
when equal, or a different way of handling equal pointers (ie., trying a
constantexpr icmp on them to see whether we know they're equal or non-equal or
unsure).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151093 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/IPO/GlobalOpt.cpp
test/Transforms/GlobalOpt/constantfold-initializers.ll