[SLH] Fix a nasty bug in SLH.
commit90b723ad49d1c5b77f6e761604ae847e447ec8ad
authorChandler Carruth <chandlerc@gmail.com>
Wed, 5 Dec 2018 15:42:11 +0000 (5 15:42 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Wed, 5 Dec 2018 15:42:11 +0000 (5 15:42 +0000)
treed725df9abe90a1f804974ac2bc2ff5f7bd32ea57
parent0a251bdf60a8d83cb04c25c9e4a5b7512d0389f0
[SLH] Fix a nasty bug in SLH.

Whenever we effectively take the address of a basic block we need to
manually update that basic block to reflect that fact or later passes
such as tail duplication and tail merging can break the invariants of
the code. =/ Sadly, there doesn't appear to be any good way of
automating this or even writing a reasonable assert to catch it early.

The change seems trivially and obviously correct, but sadly the only
really good test case I have is 1000s of basic blocks. I've tried
directly writing a test case that happens to make tail duplication do
something that crashes later on, but this appears to require an
*amazingly* complex set of conditions that I've not yet reproduced.

The change is technically covered by the tests because we mark the
blocks as having their address taken, but that doesn't really count as
properly testing the functionality.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@348374 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86SpeculativeLoadHardening.cpp
test/CodeGen/X86/speculative-load-hardening-indirect.ll