[llvm] 9fc679b - [SanitizerCoverage] Simplify pc-table and improve test. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 3 14:29:29 PDT 2022


Author: Fangrui Song
Date: 2022-09-03T14:29:21-07:00
New Revision: 9fc679b87c0475481326ef720d216b4956623bfa

URL: https://github.com/llvm/llvm-project/commit/9fc679b87c0475481326ef720d216b4956623bfa
DIFF: https://github.com/llvm/llvm-project/commit/9fc679b87c0475481326ef720d216b4956623bfa.diff

LOG: [SanitizerCoverage] Simplify pc-table and improve test. NFC

Added: 
    

Modified: 
    llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
    llvm/test/Instrumentation/SanitizerCoverage/pc-table.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
index 05b48fb2dea4..095e3191ced1 100644
--- a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
+++ b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
@@ -726,8 +726,7 @@ ModuleSanitizerCoverage::CreatePCArray(Function &F,
     } else {
       PCs.push_back((Constant *)IRB.CreatePointerCast(
           BlockAddress::get(AllBlocks[i]), IntptrPtrTy));
-      PCs.push_back((Constant *)IRB.CreateIntToPtr(
-          ConstantInt::get(IntptrTy, 0), IntptrPtrTy));
+      PCs.push_back(Constant::getNullValue(IntptrPtrTy));
     }
   }
   auto *PCArray = CreateFunctionLocalArrayInSection(N * 2, F, IntptrPtrTy,

diff  --git a/llvm/test/Instrumentation/SanitizerCoverage/pc-table.ll b/llvm/test/Instrumentation/SanitizerCoverage/pc-table.ll
index f5bef6d826e8..dc7c81e68740 100644
--- a/llvm/test/Instrumentation/SanitizerCoverage/pc-table.ll
+++ b/llvm/test/Instrumentation/SanitizerCoverage/pc-table.ll
@@ -18,7 +18,7 @@ entry:
   ret void
 }
 
-; CHECK: private constant [6 x i64*] [{{.*}}@foo{{.*}}blockaddress{{.*}}blockaddress{{.*}}], section "__sancov_pcs", comdat($foo), align 8
+; CHECK: private constant [6 x i64*] [i64* bitcast (void (i32*)* @foo to i64*), i64* inttoptr (i64 1 to i64*), i64* bitcast (i8* blockaddress(@foo, %entry.if.end_crit_edge) to i64*), i64* null, i64* bitcast (i8* blockaddress(@foo, %if.then) to i64*), i64* null], section "__sancov_pcs", comdat($foo), align 8
 ; CHECK:      @__start___sancov_pcs = extern_weak hidden global i64
 ; CHECK-NEXT: @__stop___sancov_pcs = extern_weak hidden global i64
 ; CHECK: define internal void @sancov.module_ctor


        


More information about the llvm-commits mailing list