Fix auto-upgrade of TBAA tags in Bitcode Reader
authorMehdi Amini <mehdi.amini@apple.com>
Wed, 14 Sep 2016 22:29:59 +0000 (22:29 +0000)
committerMehdi Amini <mehdi.amini@apple.com>
Wed, 14 Sep 2016 22:29:59 +0000 (22:29 +0000)
commite470927187f6a3848613a41ba98a21471800ed0d
tree26099177f5b181840636de331551ea23b975c1fb
parent8d22e6c27ba54e9eba3fa0294f08bbced7447b3f
Fix auto-upgrade of TBAA tags in Bitcode Reader

If TBAA is on an intrinsic and it gets upgraded, it'll delete the call
instruction that we collected in a vector. Even if we were to use
WeakVH, it'll drop the TBAA and we'll hit the assert on the upgrade
path.

r263673 gave a shot to make sure the TBAA upgrade happens before
intrinsics upgrade, but failed to account for all cases.

Instead of collecting instructions in a vector, this patch makes it
just upgrade the TBAA on the fly, because metadata are always
already loaded at this point.

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

llvm-svn: 281549
llvm/include/llvm/IR/AutoUpgrade.h
llvm/lib/AsmParser/LLParser.cpp
llvm/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/lib/IR/AutoUpgrade.cpp
llvm/test/LTO/X86/Inputs/remangle_intrinsics_tbaa.ll [new file with mode: 0644]
llvm/test/LTO/X86/remangle_intrinsics_tbaa.ll [new file with mode: 0644]
llvm/tools/llvm-link/llvm-link.cpp