This is an archive of the discontinued LLVM Phabricator instance.

Move *San module passes later in the NPM pipeline
ClosedPublic

Authored by aeubanks on Jun 5 2020, 6:21 PM.

Details

Summary

This fixes pr33372.cpp under the new pass manager.

ASan adds padding to globals. For example, it will change a {i32, i32, i32} to a {{i32, i32, i32}, [52 x i8]}. However, when loading from the {i32, i32, i32}, InstCombine may (after various optimizations) end up loading 16 bytes instead of 12, likely because it thinks the [52 x i8] padding is ok to load from. But ASan checks that padding should not be loaded from.

Ultimately this is an issue of *San passes wanting to be run after all optimizations. This change moves the module passes right next to the corresponding function passes.

Also remove comment that's no longer relevant, this is the last ASan/MSan/TSan failure under the NPM (hopefully...).

As mentioned in https://reviews.llvm.org/rG1285e8bcac2c54ddd924ffb813b2b187467ac2a6, NPM doesn't support LTO + sanitizers, so modified some tests that test for that.

Diff Detail

Event Timeline

aeubanks created this revision.Jun 5 2020, 6:21 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 5 2020, 6:21 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript

This is causing some tests under check-clang to fail, taking a look.

vitalybuka accepted this revision.Jun 5 2020, 7:57 PM
This revision is now accepted and ready to land.Jun 5 2020, 7:57 PM
aeubanks updated this revision to Diff 268993.Jun 5 2020, 9:18 PM

Update some tests

Could you take a look again at the test changes?
LTO + sanitizers doesn't work under NPM because [1] never ends up calling the passes registered via registerOptimizerLastEPCallback().

[1] https://github.com/llvm/llvm-project/blob/e429cffd4f228f70c1d9df0e5d77c08590dd9766/clang/lib/CodeGen/BackendUtil.cpp#L1352

aeubanks edited the summary of this revision. (Show Details)Jun 5 2020, 9:23 PM
leonardchan accepted this revision.Jun 8 2020, 11:34 AM
This revision was automatically updated to reflect the committed changes.