[llvm] 5ac5c0e - [llvm][X86WinEHState] Replace calls to 'Type::getPointerTo' (NFC)

Youngsuk Kim via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 24 17:19:36 PST 2023


Author: Youngsuk Kim
Date: 2023-11-24T19:13:20-06:00
New Revision: 5ac5c0e7d1007745456329dbcf05aa15b50c08c8

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

LOG: [llvm][X86WinEHState] Replace calls to 'Type::getPointerTo' (NFC)

Work towards to the TODO item of removing method `Type::getPointerTo`
(as noted in llvm/include/llvm/IR/Type.h).

Added: 
    

Modified: 
    llvm/lib/Target/X86/X86WinEHState.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86WinEHState.cpp b/llvm/lib/Target/X86/X86WinEHState.cpp
index e041c121679a83f..578d653c1e0ada2 100644
--- a/llvm/lib/Target/X86/X86WinEHState.cpp
+++ b/llvm/lib/Target/X86/X86WinEHState.cpp
@@ -418,13 +418,13 @@ void WinEHStatePass::linkExceptionRegistration(IRBuilder<> &Builder,
   // Emit the .safeseh directive for this function.
   Handler->addFnAttr("safeseh");
 
+  LLVMContext &C = Builder.getContext();
   Type *LinkTy = getEHLinkRegistrationType();
   // Handler = Handler
   Builder.CreateStore(Handler, Builder.CreateStructGEP(LinkTy, Link, 1));
   // Next = [fs:00]
-  Constant *FSZero =
-      Constant::getNullValue(LinkTy->getPointerTo()->getPointerTo(257));
-  Value *Next = Builder.CreateLoad(LinkTy->getPointerTo(), FSZero);
+  Constant *FSZero = Constant::getNullValue(PointerType::get(C, 257));
+  Value *Next = Builder.CreateLoad(PointerType::getUnqual(C), FSZero);
   Builder.CreateStore(Next, Builder.CreateStructGEP(LinkTy, Link, 0));
   // [fs:00] = Link
   Builder.CreateStore(Link, FSZero);
@@ -437,12 +437,13 @@ void WinEHStatePass::unlinkExceptionRegistration(IRBuilder<> &Builder) {
     Builder.Insert(GEP);
     Link = GEP;
   }
+
+  LLVMContext &C = Builder.getContext();
   Type *LinkTy = getEHLinkRegistrationType();
   // [fs:00] = Link->Next
-  Value *Next = Builder.CreateLoad(LinkTy->getPointerTo(),
+  Value *Next = Builder.CreateLoad(PointerType::getUnqual(C),
                                    Builder.CreateStructGEP(LinkTy, Link, 0));
-  Constant *FSZero =
-      Constant::getNullValue(LinkTy->getPointerTo()->getPointerTo(257));
+  Constant *FSZero = Constant::getNullValue(PointerType::get(C, 257));
   Builder.CreateStore(Next, FSZero);
 }
 


        


More information about the llvm-commits mailing list