This is an archive of the discontinued LLVM Phabricator instance.

[TTI][ASAN] Introduce TTI::getInterestingMemoryOperand and basic RISC-V support.
Needs ReviewPublic

Authored by fakepaper56 on Apr 23 2023, 8:34 AM.

Details

Summary

The patch is a proof of concept to create a hook to make AddressSanitizer to
handle target intrinsics for memory references.
The function getInterestingMemoryOperand(Intrinsic) will return an InterestingMemoryOperand
object of the input intrinsic. InterestingMemoryOperand is a data structure
to track information of memory references and used by AddressSanitizer and
HWAddressSanitizer.

Diff Detail

Event Timeline

fakepaper56 created this revision.Apr 23 2023, 8:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 23 2023, 8:34 AM
Herald added subscribers: hoy, luke, Enna1 and 23 others. · View Herald Transcript
fakepaper56 requested review of this revision.Apr 23 2023, 8:34 AM
arichardson added inline comments.Apr 23 2023, 9:52 AM
llvm/include/llvm/Analysis/TargetTransformInfo.h
32

This looks like a layering violation? I don't think analysis can depend on this?

2296

Missing e here.

fakepaper56 added inline comments.Apr 23 2023, 7:56 PM
llvm/include/llvm/Analysis/TargetTransformInfo.h
32

Thank you for your reminder. I think we could create a new file "llvm/Support/InterestingMemoryOperand.h" to move InterestingMemoryOperand out. Do you think it is a good idea?

craig.topper edited the summary of this revision. (Show Details)Apr 23 2023, 8:34 PM
craig.topper added inline comments.
llvm/include/llvm/Analysis/TargetTransformInfo.h
889

Interesting is mispelled

craig.topper edited the summary of this revision. (Show Details)Apr 23 2023, 8:36 PM

This update does 3 things,

  1. Refine commit message.
  2. Create llvm/include/llvm/Support/InterestingMemoryOperand.h to define InterestingMemoryOperand.
  3. Fix typos.
fakepaper56 marked 2 inline comments as done.Apr 23 2023, 8:57 PM
fakepaper56 retitled this revision from [TTI][ASAN] Introduce TTI::getInterstingMemoryOperand. to [TTI][ASAN] Introduce TTI::getInterestingMemoryOperand..
fakepaper56 edited the summary of this revision. (Show Details)
kito-cheng added inline comments.
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
1307–1312

nit: combine into the existing if-then-else chain.

Move invoke of TTI::getInterestingMemoryOperand to address Kito's comment.

fakepaper56 marked an inline comment as done.Apr 24 2023, 2:26 AM
kparzysz added inline comments.
llvm/include/llvm/Analysis/TargetTransformInfo.h
889

The term "interesting" is meaningless in this context. We should use more descriptive names in files that are shared among multiple users.

llvm/include/llvm/Support/InterestingMemoryOperand.h
1

The comment is out of date.

fakepaper56 added inline comments.Apr 24 2023, 9:17 AM
llvm/include/llvm/Analysis/TargetTransformInfo.h
889

I am bad at naming. Do you think MemoryRefInfo is a good new name?

kparzysz added inline comments.Apr 24 2023, 12:52 PM
llvm/include/llvm/Analysis/TargetTransformInfo.h
889

Sounds a lot better to me.

Rename InterestingMemoryOperand to MemoryRefUse.

Update test and commit message.

fakepaper56 retitled this revision from [TTI][ASAN] Introduce TTI::getInterestingMemoryOperand. to [TTI][ASAN] Introduce TTI::getInterestingMemoryOperand and basic RISC-V support..May 2 2023, 6:56 PM

Rebase and ping.