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

via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 19 08:38:57 PDT 2024


Author: Florian Mayer
Date: 2024-03-19T08:38:53-07:00
New Revision: c20596ca2bbeb1926ece1f03f25fdd138933c916

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

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

Added: 
    

Modified: 
    llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
index 9c814e1de42a32..469cb1c2de2d98 100644
--- a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -410,8 +410,8 @@ class HWAddressSanitizer {
   ShadowMapping Mapping;
 
   Type *VoidTy = Type::getVoidTy(M.getContext());
-  Type *IntptrTy;
-  PointerType *PtrTy;
+  Type *IntptrTy = M.getDataLayout().getIntPtrType(M.getContext());
+  PointerType *PtrTy = PointerType::getUnqual(M.getContext());
   Type *Int8Ty = Type::getInt8Ty(M.getContext());
   Type *Int32Ty = Type::getInt32Ty(M.getContext());
   Type *Int64Ty = Type::getInt64Ty(M.getContext());
@@ -594,8 +594,6 @@ void HWAddressSanitizer::createHwasanCtorComdat() {
 /// inserts a call to __hwasan_init to the module's constructor list.
 void HWAddressSanitizer::initializeModule() {
   LLVM_DEBUG(dbgs() << "Init " << M.getName() << "\n");
-  auto &DL = M.getDataLayout();
-
   TargetTriple = Triple(M.getTargetTriple());
 
   // x86_64 currently has two modes:
@@ -613,8 +611,6 @@ void HWAddressSanitizer::initializeModule() {
 
   C = &(M.getContext());
   IRBuilder<> IRB(*C);
-  IntptrTy = IRB.getIntPtrTy(DL);
-  PtrTy = IRB.getPtrTy();
 
   HwasanCtorFunction = nullptr;
 


        


More information about the llvm-commits mailing list