================
@@ -123,26 +124,41 @@ static bool lowerAllowChecks(Function &F, const 
BlockFrequencyInfo &BFI,
     switch (ID) {
     case Intrinsic::allow_ubsan_check:
     case Intrinsic::allow_runtime_check: {
-      ++NumChecksTotal;
-
       bool ToRemove = ShouldRemove(II);
 
       ReplaceWithValue.push_back({
           II,
-          ToRemove,
+          !ToRemove,
       });
-      if (ToRemove)
-        ++NumChecksRemoved;
       emitRemark(II, ORE, ToRemove);
       break;
     }
+    case Intrinsic::allow_sanitize_address:
+      ReplaceWithValue.push_back(
+          {II, F.hasFnAttribute(Attribute::SanitizeAddress)});
+      break;
+    case Intrinsic::allow_sanitize_thread:
+      ReplaceWithValue.push_back(
+          {II, F.hasFnAttribute(Attribute::SanitizeThread)});
+      break;
+    case Intrinsic::allow_sanitize_memory:
+      ReplaceWithValue.push_back(
+          {II, F.hasFnAttribute(Attribute::SanitizeMemory)});
+      break;
+    case Intrinsic::allow_sanitize_hwaddress:
+      ReplaceWithValue.push_back(
+          {II, F.hasFnAttribute(Attribute::SanitizeHWAddress)});
+      break;
     default:
       break;
     }
   }
 
   for (auto [I, V] : ReplaceWithValue) {
-    I->replaceAllUsesWith(ConstantInt::getBool(I->getType(), !V));
+    ++NumChecksTotal;
+    if (!V) // If the final value is false, the check is considered removed
----------------
ramosian-glider wrote:

Nit: period at the end of the line.

https://github.com/llvm/llvm-project/pull/172029
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to