[llvm] [HWASAN] Emit optimization remarks (PR #88332)

Florian Mayer via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 5 18:02:55 PDT 2024


================
@@ -1492,23 +1493,42 @@ bool HWAddressSanitizer::instrumentStack(memtag::StackInfo &SInfo,
   return true;
 }
 
+static void emitRemark(const Function &F, OptimizationRemarkEmitter &ORE,
+                       bool Skip) {
+  if (Skip) {
+    ORE.emit([&]() {
+      return OptimizationRemark(DEBUG_TYPE, "Skip", &F)
+             << "Skipped: F=" << ore::NV("Function", &F);
+    });
+  } else {
+    ORE.emit([&]() {
+      return OptimizationRemarkMissed(DEBUG_TYPE, "Sanitize", &F)
+             << "Sanitized: F=" << ore::NV("Function", &F);
----------------
fmayer wrote:

Why do we need this arg? We already have the F in the output either way.

Now the output looks like this

```
--- !Missed
Pass:            hwasan
Name:            Sanitize
Function:        test_retptr
Args:
  - String:          'Sanitized: F='
  - Function:        test_retptr
...

I suggest just making this `OptimizationRemarkMissed(DEBUG_TYPE, "Sanitize", &F);` Same above
```

https://github.com/llvm/llvm-project/pull/88332


More information about the llvm-commits mailing list