[TSan] Use zeroext for function parameters
authorIlya Leoshkevich <iii@linux.ibm.com>
Fri, 2 Jul 2021 00:42:24 +0000 (02:42 +0200)
committerIlya Leoshkevich <iii@linux.ibm.com>
Thu, 15 Jul 2021 10:18:47 +0000 (12:18 +0200)
commit3845f2cd940bd394fc735388ca0cd6652a98b7b9
tree6add12c5db696037ca6d631401b22056ba738f05
parentcadbb9241627eefc9f589ae4376fd9ed3e272ecc
[TSan] Use zeroext for function parameters

SystemZ ABI requires zero-extending function parameters to 64-bit. The
compiler is free to optimize the code around this assumption, e.g.
failing to zero-extend __tsan_atomic32_load()'s morder may cause
crashes in to_mo() switch table lookup.

Fix by adding zeroext attributes to TSan's FunctionCallees, similar to
how it was done in commit 3bc439bdff8b ("[MSan] Add instrumentation for
SystemZ"). This is a no-op on arches that don't need it.

Reviewed By: dvyukov

Differential Revision: https://reviews.llvm.org/D105629
llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp