[llvm] [NFC] [hwasan] also be more consistent when getting pointer types (PR #84399)

Florian Mayer via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 7 16:07:53 PST 2024


https://github.com/fmayer updated https://github.com/llvm/llvm-project/pull/84399

>From 66bffabbe90ee44aa905f7bf445f21a8e3d222e8 Mon Sep 17 00:00:00 2001
From: Florian Mayer <fmayer at google.com>
Date: Thu, 7 Mar 2024 15:17:51 -0800
Subject: [PATCH 1/2] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20ch?=
 =?UTF-8?q?anges=20to=20main=20this=20commit=20is=20based=20on?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4

[skip ci]
---
 llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
index 236ee8910d46ab..289183ecf0f286 100644
--- a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -412,8 +412,8 @@ class HWAddressSanitizer {
   Type *VoidTy = Type::getVoidTy(M.getContext());
   Type *IntptrTy;
   PointerType *PtrTy;
-  Type *Int8Ty;
-  Type *Int32Ty;
+  Type *Int8Ty = Type::getInt8Ty(M.getContext());
+  Type *Int32Ty = Type::getInt32Ty(M.getContext());
   Type *Int64Ty = Type::getInt64Ty(M.getContext());
 
   bool CompileKernel;
@@ -615,8 +615,6 @@ void HWAddressSanitizer::initializeModule() {
   IRBuilder<> IRB(*C);
   IntptrTy = IRB.getIntPtrTy(DL);
   PtrTy = IRB.getPtrTy();
-  Int8Ty = IRB.getInt8Ty();
-  Int32Ty = IRB.getInt32Ty();
 
   HwasanCtorFunction = nullptr;
 

>From 89324d31305690760f78385e0e157716029433f4 Mon Sep 17 00:00:00 2001
From: Florian Mayer <fmayer at google.com>
Date: Thu, 7 Mar 2024 16:07:43 -0800
Subject: [PATCH 2/2] fmt

Created using spr 1.3.4
---
 llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
index 61d54b850374e1..1364d0b50edeca 100644
--- a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -411,7 +411,7 @@ class HWAddressSanitizer {
 
   Type *VoidTy = Type::getVoidTy(M.getContext());
   Type *IntptrTy = M.getDataLayout().getIntPtrType(M.getContext());
-  PointerType *PtrTy = PointerType::get(M.getContext(), /* AddressSpace= */0);
+  PointerType *PtrTy = PointerType::get(M.getContext(), /* AddressSpace= */ 0);
   Type *Int8Ty = Type::getInt8Ty(M.getContext());
   Type *Int32Ty = Type::getInt32Ty(M.getContext());
   Type *Int64Ty = Type::getInt64Ty(M.getContext());



More information about the llvm-commits mailing list