This is an archive of the discontinued LLVM Phabricator instance.

Fix auto-upgrade of TBAA tags in Bitcode Reader
ClosedPublic

Authored by mehdi_amini on Sep 13 2016, 4:36 PM.

Details

Summary

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.

Diff Detail

Repository
rL LLVM

Event Timeline

mehdi_amini retitled this revision from to Fix auto-upgrade of TBAA tags in Bitcode Reader.
mehdi_amini updated this object.
mehdi_amini added reviewers: dexonsmith, manmanren.
mehdi_amini added a subscriber: llvm-commits.

Sorry forgot the test case, will update soon!

  • Fix the assert
  • Apply Duncan's suggestion of inlining UpgradeInstWithTBAATag
  • Add a llvm-link test
majnemer added inline comments.
lib/AsmParser/LLParser.cpp
225–226 ↗(On Diff #71292)

Range-based loop?

lib/Bitcode/Reader/BitcodeReader.cpp
3752–3753 ↗(On Diff #71292)

Return after return?

mehdi_amini added inline comments.Sep 13 2016, 8:43 PM
lib/AsmParser/LLParser.cpp
225–226 ↗(On Diff #71292)

Sure, good cleanup!
(The whole file deserves some probably)

lib/Bitcode/Reader/BitcodeReader.cpp
3752–3753 ↗(On Diff #71292)

Some debug slipped...

mehdi_amini marked 4 inline comments as done.Sep 13 2016, 8:48 PM
This revision was automatically updated to reflect the committed changes.