[AddressSanitizer] Refactor: Permit >1 interesting operands per instruction
authorJann Horn <jannh@google.com>
Thu, 30 Apr 2020 09:05:00 +0000 (11:05 +0200)
committerAlexander Potapenko <glider@google.com>
Thu, 30 Apr 2020 15:09:13 +0000 (17:09 +0200)
commitcfe36e4c6a6671f21c2daf43a0ea33edb4477bc5
tree6dc844edeffb277a4c49eacc9e9329714c8650d5
parent223a95fdf078b22122732f2173ce37e971f080c4
[AddressSanitizer] Refactor: Permit >1 interesting operands per instruction

Summary:
Refactor getInterestingMemoryOperands() so that information about the
pointer operand is returned through an array of structures instead of
passing each piece of information separately by-value.

This is in preparation for returning information about multiple pointer
operands from a single instruction.

A side effect is that, instead of repeatedly generating the same
information through isInterestingMemoryAccess(), it is now simply collected
once and then passed around; that's probably more efficient.

HWAddressSanitizer has a bunch of copypasted code from AddressSanitizer,
so these changes have to be duplicated.

This is patch 3/4 of a patch series:
https://reviews.llvm.org/D77616 [PATCH 1/4] [AddressSanitizer] Refactor ClDebug{Min,Max} handling
https://reviews.llvm.org/D77617 [PATCH 2/4] [AddressSanitizer] Split out memory intrinsic handling
https://reviews.llvm.org/D77618 [PATCH 3/4] [AddressSanitizer] Refactor: Permit >1 interesting operands per instruction
https://reviews.llvm.org/D77619 [PATCH 4/4] [AddressSanitizer] Instrument byval call arguments

[glider: renamed llvm::InterestingMemoryOperand::Type to OpType to fix
GCC compilation]

Reviewers: kcc, glider

Reviewed By: glider

Subscribers: hiraditya, jfb, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D77618
llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerCommon.h [new file with mode: 0644]
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp