Rephrase the speculating scan of the conditional BB to be phrased in
authorChandler Carruth <chandlerc@gmail.com>
Thu, 24 Jan 2013 11:52:58 +0000 (11:52 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Thu, 24 Jan 2013 11:52:58 +0000 (11:52 +0000)
commit7481ca8ff538f96472b32e845b8b086d3364c82d
treec4195c34df75d89bfd44ffb1212c9b1a6759a6f6
parente35d59a8d0c68e6e7c1cf1be1908915efb6cc65c
Rephrase the speculating scan of the conditional BB to be phrased in
terms of cost rather than hoisting a single instruction.

This does *not* change the cost model! We still set the cost threshold
at 1 here, it's just that we track it by accumulating cost rather than
by storing an instruction.

The primary advantage is that we no longer leave no-op intrinsics in the
basic block. For example, this will now move both debug info intrinsics
and a single instruction, instead of only moving the instruction and
leaving a basic block with nothing bug debug info intrinsics in it, and
those intrinsics now no longer ordered correctly with the hoisted value.

Instead, we now splice the entire conditional basic block's instruction
sequence.

This also places the code for checking the safety of hoisting next to
the code computing the cost.

Currently, the only observable side-effect of this change is that debug
info intrinsics are no longer abandoned. I'm not sure how to craft
a test case for this, and my real goal was the refactoring, but I'll
talk to Dave or Eric about how to add a test case for this.

llvm-svn: 173339
llvm/lib/Transforms/Utils/SimplifyCFG.cpp