[llvm] 60c60dd - [ASAN] NFC: Use addrspace cast for pointers in non-zero addrspace

Reshabh Sharma via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 28 22:36:47 PDT 2021


Author: Reshabh Sharma
Date: 2021-04-29T11:06:00+05:30
New Revision: 60c60dd1387742730b5cc756f8d92bac2e23c2b0

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

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

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

Reviewed by: vitalybuka

Differential Revision: https://reviews.llvm.org/D101363

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/ModuleUtils.cpp b/llvm/lib/Transforms/Utils/ModuleUtils.cpp
index 4ad9837a0d35..8c6435b52387 100644
--- a/llvm/lib/Transforms/Utils/ModuleUtils.cpp
+++ b/llvm/lib/Transforms/Utils/ModuleUtils.cpp
@@ -89,7 +89,7 @@ static void appendToUsedList(Module &M, StringRef Name, ArrayRef<GlobalValue *>
 
   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);
   }


        


More information about the llvm-commits mailing list