[PATCH] D131575: [RISC-V][HWASAN] Add support for HWASAN code instrumentation for RISC-V

Alexey Baturo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 17 09:03:33 PDT 2022


smd added inline comments.


================
Comment at: llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp:838
+  // In case of RISC-V always use shortgranules
   IRB.CreateCall(Intrinsic::getDeclaration(
+                     M, UseShortGranules || TargetTriple.isRISCV64()
----------------
vitalybuka wrote:
> Code should respect ClUseShortGranules, even if it's not useful mode.
> Otherwise UseShortGranules should be true for non android
> 
@vitalybuka 
Could you please clarify:
If I get you right, you're suggesting allowing users to override UseShortGranules and make it false, even if the platform doesn't support this mode, right? 
For cases rather than this, short granules would be always used. If the user decides to use non-short granules for riscv, in this case the compilation would fail with:
```
fatal error: error in backend: Cannot select: intrinsic %llvm.hwasan.check.memaccess
```
which is sort of ok, I guess. But maybe an explicit check like (isRISCV64() && !UseShortGranules) with an error message would be a better idea?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131575/new/

https://reviews.llvm.org/D131575



More information about the llvm-commits mailing list