[MergedLoadStoreMotion] Fix a debug invariant bug in mergeStores
authorBjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Wed, 9 May 2018 06:52:12 +0000 (06:52 +0000)
committerBjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Wed, 9 May 2018 06:52:12 +0000 (06:52 +0000)
commit9f953cdd7c3f0e77d1a53948d0128e37ab5ea994
tree30135c9760fa588877159f6099e4b0490d4abcfd
parentd62b3e8f5dc4708d1e6c6a37ed910d947484a74c
[MergedLoadStoreMotion] Fix a debug invariant bug in mergeStores

Summary:
MergedLoadStoreMotion::mergeStores is using some heuristics
to limit the amount of stores that it tries to sink (see
MagicCompileTimeControl in MergedLoadStoreMotion.cpp). The
heuristic involves counting the number of instructions in
one of the basic blocks that is part of the transformation.

We now ignore dbg intrinsics when counting instruction for
the MagicCompileTimeControl heuristic. This to make sure that
the amount of stores that are sunk doesn't depend on the amount
of debug information (if -g is used or not).

Reviewers: Gerolf, davide, majnemer

Reviewed By: davide

Subscribers: dberlin, bjope, aprantl, JDevlieghere, llvm-commits

Differential Revision: https://reviews.llvm.org/D46600

llvm-svn: 331852
llvm/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp
llvm/test/Transforms/InstMerge/st_sink_debuginvariant.ll [new file with mode: 0644]