[PATCH] D101363: [ASAN] NFC: Use addrspace cast for pointers in non-zero addrspace

Reshabh Sharma via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 27 06:53:51 PDT 2021


rksharma created this revision.
rksharma added a reviewer: vitalybuka.
Herald added a subscriber: hiraditya.
rksharma requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Pointers in non-zero address spaces need to be address space casted before appending to the used list.


https://reviews.llvm.org/D101363

Files:
  llvm/lib/Transforms/Utils/ModuleUtils.cpp


Index: llvm/lib/Transforms/Utils/ModuleUtils.cpp
===================================================================
--- llvm/lib/Transforms/Utils/ModuleUtils.cpp
+++ llvm/lib/Transforms/Utils/ModuleUtils.cpp
@@ -89,7 +89,7 @@
 
   Type *Int8PtrTy = llvm::Type::getInt8PtrTy(M.getContext());
   for (auto *V : Values) {
-    Constant *C = ConstantExpr::getBitCast(V, Int8PtrTy);
+    Constant *C = ConstantExpr::getPointerBitCastOrAddrSpaceCast(V, Int8PtrTy);
     if (InitAsSet.insert(C).second)
       Init.push_back(C);
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101363.340823.patch
Type: text/x-patch
Size: 528 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210427/23b6d420/attachment.bin>


More information about the llvm-commits mailing list