[llvm] [HWASAN] Follow up for #83503 implement selective instrumentation (PR #83942)

Kirill Stoimenov via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 6 15:18:41 PST 2024


https://github.com/kstoimenov updated https://github.com/llvm/llvm-project/pull/83942

>From 7b69b728bae8a38ce614af9f704c99f44ee72f73 Mon Sep 17 00:00:00 2001
From: Kirill Stoimenov <kstoimenov at google.com>
Date: Tue, 5 Mar 2024 01:44:32 +0000
Subject: [PATCH 1/5] [HWASAN] Change tests to use IR instead of -stats to
 avoid depnding on Debug mode, add SkipInstrumentationRandomRate and remove
 HWASAN from stat strings.

---
 .../Instrumentation/HWAddressSanitizer.cpp    | 15 +++++++--
 .../HWAddressSanitizer/pgo-opt-out-no-ps.ll   | 32 +++++++++++++------
 .../HWAddressSanitizer/pgo-opt-out.ll         | 23 +++++++------
 3 files changed, 48 insertions(+), 22 deletions(-)

diff --git a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
index 4404382a85b7e3..92f8687030d609 100644
--- a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -83,6 +83,8 @@ static const uint64_t kDynamicShadowSentinel =
 
 static const unsigned kShadowBaseAlignment = 32;
 
+static constexpr unsigned MaxRandomRate = 1000;
+
 static cl::opt<std::string>
     ClMemoryAccessCallbackPrefix("hwasan-memory-access-callback-prefix",
                                  cl::desc("Prefix for memory access callbacks"),
@@ -188,9 +190,13 @@ static cl::opt<bool>
 static cl::opt<int> HotPercentileCutoff("hwasan-percentile-cutoff-hot",
                                         cl::init(0));
 
-STATISTIC(NumTotalFuncs, "Number of total funcs HWASAN");
-STATISTIC(NumInstrumentedFuncs, "Number of HWASAN instrumented funcs");
-STATISTIC(NumNoProfileSummaryFuncs, "Number of HWASAN funcs without PS");
+static cl::opt<float> SkipInstRandomRate(
+    "hwasan-skip-inst-random-rate", cl::init(0.0),
+    cl::desc("Probability to skip instrumentation of a function."));
+
+STATISTIC(NumTotalFuncs, "Number of total funcs");
+STATISTIC(NumInstrumentedFuncs, "Number of instrumented funcs");
+STATISTIC(NumNoProfileSummaryFuncs, "Number of funcs without PS");
 
 // Mode for selecting how to insert frame record info into the stack ring
 // buffer.
@@ -1527,6 +1533,9 @@ void HWAddressSanitizer::sanitizeFunction(Function &F,
 
   NumTotalFuncs++;
   if (CSkipHotCode) {
+    if ((F.getGUID() % MaxRandomRate) < SkipInstRandomRate) {
+      return;
+    }
     auto &MAMProxy = FAM.getResult<ModuleAnalysisManagerFunctionProxy>(F);
     ProfileSummaryInfo *PSI =
         MAMProxy.getCachedResult<ProfileSummaryAnalysis>(*F.getParent());
diff --git a/llvm/test/Instrumentation/HWAddressSanitizer/pgo-opt-out-no-ps.ll b/llvm/test/Instrumentation/HWAddressSanitizer/pgo-opt-out-no-ps.ll
index 2aa218fa1522d6..c3c2cbe2d5bb92 100644
--- a/llvm/test/Instrumentation/HWAddressSanitizer/pgo-opt-out-no-ps.ll
+++ b/llvm/test/Instrumentation/HWAddressSanitizer/pgo-opt-out-no-ps.ll
@@ -1,16 +1,28 @@
-; RUN: opt < %s -passes='require<profile-summary>,hwasan' -S -stats 2>&1 \
+; RUN: opt < %s -passes='require<profile-summary>,hwasan' -S  \
 ; RUN:   -hwasan-skip-hot-code=0 | FileCheck %s --check-prefix=FULL
-; RUN: opt < %s -passes='require<profile-summary>,hwasan' -S -stats 2>&1 \
+; RUN: opt < %s -passes='require<profile-summary>,hwasan' -S  \
 ; RUN:   -hwasan-skip-hot-code=1 | FileCheck %s --check-prefix=SELSAN
 
-; REQUIRES: asserts
+; FULL: @not_sanitized
+; FULL-NEXT: %x = alloca i8, i64 4
+; FULL: @sanitized_no_ps
+; FULL-SAME: @__hwasan_personality_thunk
 
-; FULL: 1 hwasan - Number of HWASAN instrumented funcs
-; FULL: 1 hwasan - Number of total funcs HWASAN
+; SELSAN: @not_sanitized
+; SELSAN-NEXT: %x = alloca i8, i64 4
+; SELSAN: @sanitized_no_ps
+; SELSAN-SAME: @__hwasan_personality_thunk
 
-; SELSAN: 1 hwasan - Number of HWASAN instrumented funcs
-; SELSAN: 1 hwasan - Number of HWASAN funcs without PS
-; SELSAN: 1 hwasan - Number of total funcs HWASAN
+declare void @use(ptr)
 
-define void @not_sanitized() { ret void }
-define void @sanitized_no_ps() sanitize_hwaddress { ret void }
+define void @not_sanitized() {
+  %x = alloca i8, i64 4
+  call void @use(ptr %x)
+  ret void
+ }
+
+define void @sanitized_no_ps() sanitize_hwaddress {
+  %x = alloca i8, i64 4
+  call void @use(ptr %x)
+  ret void
+ }
diff --git a/llvm/test/Instrumentation/HWAddressSanitizer/pgo-opt-out.ll b/llvm/test/Instrumentation/HWAddressSanitizer/pgo-opt-out.ll
index 65a5f8c9689678..9cdb927f06760e 100644
--- a/llvm/test/Instrumentation/HWAddressSanitizer/pgo-opt-out.ll
+++ b/llvm/test/Instrumentation/HWAddressSanitizer/pgo-opt-out.ll
@@ -1,16 +1,21 @@
-; RUN: opt < %s -passes='require<profile-summary>,hwasan' -S -stats 2>&1 \
-; RUN:   -hwasan-skip-hot-code=1 | FileCheck %s --check-prefix=DEFAULT
-; RUN: opt < %s -passes='require<profile-summary>,hwasan' -S -stats 2>&1 \
-; RUN:   -hwasan-skip-hot-code=1 -hwasan-percentile-cutoff-hot=700000 | FileCheck %s --check-prefix=PERCENT
+; RUN: opt < %s -passes='require<profile-summary>,hwasan' -S -hwasan-skip-hot-code=1 \
+; RUN:    | FileCheck %s --check-prefix=DEFAULT
+; RUN: opt < %s -passes='require<profile-summary>,hwasan' -S -hwasan-skip-hot-code=1 \
+; RUN:    -hwasan-percentile-cutoff-hot=700000 | FileCheck %s --check-prefix=PERCENT
 
-; REQUIRES: asserts
+; DEFAULT: @sanitized
+; DEFAULT-NEXT: %x = alloca i8, i64 4
 
-; DEFAULT: 1 hwasan - Number of total funcs HWASAN
+; PERCENT: @sanitized
+; PERCENT-SAME: @__hwasan_personality_thunk
 
-; PERCENT: 1 hwasan - Number of HWASAN instrumented funcs
-; PERCENT: 1 hwasan - Number of total funcs HWASAN
+declare void @use(ptr)
 
-define void @sanitized() sanitize_hwaddress !prof !36 { ret void }
+define void @sanitized(i32 noundef %0) sanitize_hwaddress !prof !36 {
+  %x = alloca i8, i64 4
+  call void @use(ptr %x)
+  ret void
+}
 
 !llvm.module.flags = !{!6}
 !6 = !{i32 1, !"ProfileSummary", !7}

>From 8acaf614f1bfd4885125a112b8796421395ac37a Mon Sep 17 00:00:00 2001
From: Kirill Stoimenov <kstoimenov at google.com>
Date: Tue, 5 Mar 2024 01:44:32 +0000
Subject: [PATCH 2/5] [HWASAN] Change tests to use IR instead of -stats to
 avoid depnding on Debug mode, add SkipInstrumentationRandomRate and remove
 HWASAN from stat strings.

---
 .../Instrumentation/HWAddressSanitizer.cpp    | 40 +++++++++++--------
 1 file changed, 24 insertions(+), 16 deletions(-)

diff --git a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
index 92f8687030d609..5d1c9615a55289 100644
--- a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -60,7 +60,9 @@
 #include "llvm/Transforms/Utils/MemoryTaggingSupport.h"
 #include "llvm/Transforms/Utils/ModuleUtils.h"
 #include "llvm/Transforms/Utils/PromoteMemToReg.h"
+#include "llvm/Support/RandomNumberGenerator.h"
 #include <optional>
+#include <random>
 
 using namespace llvm;
 
@@ -183,9 +185,9 @@ static cl::opt<bool> ClWithTls(
     cl::Hidden, cl::init(true));
 
 static cl::opt<bool>
-    CSkipHotCode("hwasan-skip-hot-code",
-                 cl::desc("Do not instument hot functions based on FDO."),
-                 cl::Hidden, cl::init(false));
+    CSelectiveInstrumentation("hwasan-selective-instrumentation",
+                              cl::desc("IUse selective instrumentation"),
+                              cl::Hidden, cl::init(false));
 
 static cl::opt<int> HotPercentileCutoff("hwasan-percentile-cutoff-hot",
                                         cl::init(0));
@@ -1532,22 +1534,28 @@ void HWAddressSanitizer::sanitizeFunction(Function &F,
     return;
 
   NumTotalFuncs++;
-  if (CSkipHotCode) {
-    if ((F.getGUID() % MaxRandomRate) < SkipInstRandomRate) {
+  if (CSelectiveInstrumentation) {
+    if (RandomSkipRate.getNumOccurrences()) {
+      std::unique_ptr<RandomNumberGenerator> Rng = F.getParent()->createRNG(F.getName());
+      std::bernoulli_distribution D(RandomSkipRate);
+      if (D(*Rng)) return;
+    } else {
+      if ((F.getGUID() % MaxRandomRate) < SkipInstRandomRate) {
       return;
     }
     auto &MAMProxy = FAM.getResult<ModuleAnalysisManagerFunctionProxy>(F);
-    ProfileSummaryInfo *PSI =
-        MAMProxy.getCachedResult<ProfileSummaryAnalysis>(*F.getParent());
-    if (PSI && PSI->hasProfileSummary()) {
-      auto &BFI = FAM.getResult<BlockFrequencyAnalysis>(F);
-      if ((HotPercentileCutoff.getNumOccurrences() && HotPercentileCutoff >= 0)
-              ? PSI->isFunctionHotInCallGraphNthPercentile(HotPercentileCutoff,
-                                                           &F, BFI)
-              : PSI->isFunctionHotInCallGraph(&F, BFI))
-        return;
-    } else {
-      ++NumNoProfileSummaryFuncs;
+      ProfileSummaryInfo *PSI =
+          MAMProxy.getCachedResult<ProfileSummaryAnalysis>(*F.getParent());
+      if (PSI && PSI->hasProfileSummary()) {
+        auto &BFI = FAM.getResult<BlockFrequencyAnalysis>(F);
+        if ((HotPercentileCutoff.getNumOccurrences() && HotPercentileCutoff >= 0)
+                ? PSI->isFunctionHotInCallGraphNthPercentile(HotPercentileCutoff,
+                                                            &F, BFI)
+                : PSI->isFunctionHotInCallGraph(&F, BFI))
+          return;
+      } else {
+        ++NumNoProfileSummaryFuncs;
+      }
     }
   }
   NumInstrumentedFuncs++;

>From d4027440d50912bf84c937dffb6adcaaa85d05d5 Mon Sep 17 00:00:00 2001
From: Kirill Stoimenov <kstoimenov at google.com>
Date: Wed, 6 Mar 2024 21:03:37 +0000
Subject: [PATCH 3/5] Fixing code.

---
 .../Instrumentation/HWAddressSanitizer.cpp    | 11 +++-------
 .../HWAddressSanitizer/pgo-opt-out-no-ps.ll   |  8 ++++----
 .../HWAddressSanitizer/pgo-opt-out.ll         | 20 ++++++++++++++-----
 3 files changed, 22 insertions(+), 17 deletions(-)

diff --git a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
index 5d1c9615a55289..e09b58e7ef1da1 100644
--- a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -85,8 +85,6 @@ static const uint64_t kDynamicShadowSentinel =
 
 static const unsigned kShadowBaseAlignment = 32;
 
-static constexpr unsigned MaxRandomRate = 1000;
-
 static cl::opt<std::string>
     ClMemoryAccessCallbackPrefix("hwasan-memory-access-callback-prefix",
                                  cl::desc("Prefix for memory access callbacks"),
@@ -192,8 +190,8 @@ static cl::opt<bool>
 static cl::opt<int> HotPercentileCutoff("hwasan-percentile-cutoff-hot",
                                         cl::init(0));
 
-static cl::opt<float> SkipInstRandomRate(
-    "hwasan-skip-inst-random-rate", cl::init(0.0),
+static cl::opt<float> RandomSkipRate(
+    "hwasan-random-skip-rate", cl::init(0),
     cl::desc("Probability to skip instrumentation of a function."));
 
 STATISTIC(NumTotalFuncs, "Number of total funcs");
@@ -1540,10 +1538,7 @@ void HWAddressSanitizer::sanitizeFunction(Function &F,
       std::bernoulli_distribution D(RandomSkipRate);
       if (D(*Rng)) return;
     } else {
-      if ((F.getGUID() % MaxRandomRate) < SkipInstRandomRate) {
-      return;
-    }
-    auto &MAMProxy = FAM.getResult<ModuleAnalysisManagerFunctionProxy>(F);
+      auto &MAMProxy = FAM.getResult<ModuleAnalysisManagerFunctionProxy>(F);
       ProfileSummaryInfo *PSI =
           MAMProxy.getCachedResult<ProfileSummaryAnalysis>(*F.getParent());
       if (PSI && PSI->hasProfileSummary()) {
diff --git a/llvm/test/Instrumentation/HWAddressSanitizer/pgo-opt-out-no-ps.ll b/llvm/test/Instrumentation/HWAddressSanitizer/pgo-opt-out-no-ps.ll
index c3c2cbe2d5bb92..8d96ab02128850 100644
--- a/llvm/test/Instrumentation/HWAddressSanitizer/pgo-opt-out-no-ps.ll
+++ b/llvm/test/Instrumentation/HWAddressSanitizer/pgo-opt-out-no-ps.ll
@@ -1,17 +1,17 @@
 ; RUN: opt < %s -passes='require<profile-summary>,hwasan' -S  \
-; RUN:   -hwasan-skip-hot-code=0 | FileCheck %s --check-prefix=FULL
+; RUN:   -hwasan-selective-instrumentation=0 | FileCheck %s --check-prefix=FULL
 ; RUN: opt < %s -passes='require<profile-summary>,hwasan' -S  \
-; RUN:   -hwasan-skip-hot-code=1 | FileCheck %s --check-prefix=SELSAN
+; RUN:   -hwasan-selective-instrumentation=1 | FileCheck %s --check-prefix=SELSAN
 
 ; FULL: @not_sanitized
 ; FULL-NEXT: %x = alloca i8, i64 4
 ; FULL: @sanitized_no_ps
-; FULL-SAME: @__hwasan_personality_thunk
+; FULL-NEXT: @__hwasan_tls
 
 ; SELSAN: @not_sanitized
 ; SELSAN-NEXT: %x = alloca i8, i64 4
 ; SELSAN: @sanitized_no_ps
-; SELSAN-SAME: @__hwasan_personality_thunk
+; SELSAN-NEXT: @__hwasan_tls
 
 declare void @use(ptr)
 
diff --git a/llvm/test/Instrumentation/HWAddressSanitizer/pgo-opt-out.ll b/llvm/test/Instrumentation/HWAddressSanitizer/pgo-opt-out.ll
index 9cdb927f06760e..28e43a99883e5d 100644
--- a/llvm/test/Instrumentation/HWAddressSanitizer/pgo-opt-out.ll
+++ b/llvm/test/Instrumentation/HWAddressSanitizer/pgo-opt-out.ll
@@ -1,13 +1,23 @@
-; RUN: opt < %s -passes='require<profile-summary>,hwasan' -S -hwasan-skip-hot-code=1 \
+; RUN: opt < %s -passes='require<profile-summary>,hwasan' -S -hwasan-selective-instrumentation=1 \
 ; RUN:    | FileCheck %s --check-prefix=DEFAULT
-; RUN: opt < %s -passes='require<profile-summary>,hwasan' -S -hwasan-skip-hot-code=1 \
-; RUN:    -hwasan-percentile-cutoff-hot=700000 | FileCheck %s --check-prefix=PERCENT
+; RUN: opt < %s -passes='require<profile-summary>,hwasan' -S -hwasan-selective-instrumentation=1 \
+; RUN:    -hwasan-percentile-cutoff-hot=700000 | FileCheck %s --check-prefix=HOT_RATE
+; RUN: opt < %s -passes='require<profile-summary>,hwasan' -S -hwasan-selective-instrumentation=1 \
+; RUN:    -hwasan-random-skip-rate=0.0 | FileCheck %s --check-prefix=RANDOM_RATE_0
+; RUN: opt < %s -passes='require<profile-summary>,hwasan' -S -hwasan-selective-instrumentation=1 \
+; RUN:    -hwasan-random-skip-rate=1.0 | FileCheck %s --check-prefix=RANDOM_RATE_1
 
 ; DEFAULT: @sanitized
 ; DEFAULT-NEXT: %x = alloca i8, i64 4
 
-; PERCENT: @sanitized
-; PERCENT-SAME: @__hwasan_personality_thunk
+; HOT_RATE: @sanitized
+; HOT_RATE-NEXT: @__hwasan_tls
+
+; RANDOM_RATE_0: @sanitized
+; RANDOM_RATE_0-NEXT: @__hwasan_tls
+
+; RANDOM_RATE_1: @sanitized
+; RANDOM_RATE_1-NEXT: %x = alloca i8, i64 4
 
 declare void @use(ptr)
 

>From a8879e293d2f8e629673626a9805ccd0778ea556 Mon Sep 17 00:00:00 2001
From: Kirill Stoimenov <kstoimenov at google.com>
Date: Wed, 6 Mar 2024 23:07:58 +0000
Subject: [PATCH 4/5] clang format

---
 .../Instrumentation/HWAddressSanitizer.cpp        | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
index e09b58e7ef1da1..58f901616a33c1 100644
--- a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -52,6 +52,7 @@
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
+#include "llvm/Support/RandomNumberGenerator.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/TargetParser/Triple.h"
 #include "llvm/Transforms/Instrumentation/AddressSanitizerCommon.h"
@@ -60,7 +61,6 @@
 #include "llvm/Transforms/Utils/MemoryTaggingSupport.h"
 #include "llvm/Transforms/Utils/ModuleUtils.h"
 #include "llvm/Transforms/Utils/PromoteMemToReg.h"
-#include "llvm/Support/RandomNumberGenerator.h"
 #include <optional>
 #include <random>
 
@@ -1534,18 +1534,21 @@ void HWAddressSanitizer::sanitizeFunction(Function &F,
   NumTotalFuncs++;
   if (CSelectiveInstrumentation) {
     if (RandomSkipRate.getNumOccurrences()) {
-      std::unique_ptr<RandomNumberGenerator> Rng = F.getParent()->createRNG(F.getName());
+      std::unique_ptr<RandomNumberGenerator> Rng =
+          F.getParent()->createRNG(F.getName());
       std::bernoulli_distribution D(RandomSkipRate);
-      if (D(*Rng)) return;
+      if (D(*Rng))
+        return;
     } else {
       auto &MAMProxy = FAM.getResult<ModuleAnalysisManagerFunctionProxy>(F);
       ProfileSummaryInfo *PSI =
           MAMProxy.getCachedResult<ProfileSummaryAnalysis>(*F.getParent());
       if (PSI && PSI->hasProfileSummary()) {
         auto &BFI = FAM.getResult<BlockFrequencyAnalysis>(F);
-        if ((HotPercentileCutoff.getNumOccurrences() && HotPercentileCutoff >= 0)
-                ? PSI->isFunctionHotInCallGraphNthPercentile(HotPercentileCutoff,
-                                                            &F, BFI)
+        if ((HotPercentileCutoff.getNumOccurrences() &&
+             HotPercentileCutoff >= 0)
+                ? PSI->isFunctionHotInCallGraphNthPercentile(
+                      HotPercentileCutoff, &F, BFI)
                 : PSI->isFunctionHotInCallGraph(&F, BFI))
           return;
       } else {

>From af9bbdda3a08e61c4786ff74437fcce2ee4c28d5 Mon Sep 17 00:00:00 2001
From: Kirill Stoimenov <kstoimenov at google.com>
Date: Wed, 6 Mar 2024 23:18:18 +0000
Subject: [PATCH 5/5] Addressed comments.

---
 llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
index 58f901616a33c1..a14bb16504f1a6 100644
--- a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -184,7 +184,7 @@ static cl::opt<bool> ClWithTls(
 
 static cl::opt<bool>
     CSelectiveInstrumentation("hwasan-selective-instrumentation",
-                              cl::desc("IUse selective instrumentation"),
+                              cl::desc("Use selective instrumentation"),
                               cl::Hidden, cl::init(false));
 
 static cl::opt<int> HotPercentileCutoff("hwasan-percentile-cutoff-hot",
@@ -292,7 +292,7 @@ class HWAddressSanitizer {
 public:
   HWAddressSanitizer(Module &M, bool CompileKernel, bool Recover,
                      const StackSafetyGlobalInfo *SSI)
-      : M(M), SSI(SSI) {
+      : M(M), SSI(SSI), Rng(M.createRNG("hwasan")) {
     this->Recover = ClRecover.getNumOccurrences() > 0 ? ClRecover : Recover;
     this->CompileKernel = ClEnableKhwasan.getNumOccurrences() > 0
                               ? ClEnableKhwasan
@@ -378,6 +378,7 @@ class HWAddressSanitizer {
   Module &M;
   const StackSafetyGlobalInfo *SSI;
   Triple TargetTriple;
+  std::unique_ptr<RandomNumberGenerator> Rng;
 
   /// This struct defines the shadow mapping using the rule:
   ///   shadow = (mem >> Scale) + Offset.
@@ -1534,8 +1535,6 @@ void HWAddressSanitizer::sanitizeFunction(Function &F,
   NumTotalFuncs++;
   if (CSelectiveInstrumentation) {
     if (RandomSkipRate.getNumOccurrences()) {
-      std::unique_ptr<RandomNumberGenerator> Rng =
-          F.getParent()->createRNG(F.getName());
       std::bernoulli_distribution D(RandomSkipRate);
       if (D(*Rng))
         return;



More information about the llvm-commits mailing list