[PATCH] D23361: [OpenCL] AMDGCN: Fix size_t type

Yaxun Liu via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 18 08:35:51 PDT 2016


yaxunl marked an inline comment as done.

================
Comment at: lib/CodeGen/CGExprScalar.cpp:1513
@@ -1512,2 +1512,3 @@
     // extension.
-    llvm::Type *MiddleTy = CGF.IntPtrTy;
+    auto DestLLVMTy = ConvertType(DestTy);
+    llvm::Type *MiddleTy = CGF.CGM.getDataLayout().getIntPtrType(DestLLVMTy);
----------------
Anastasia wrote:
> Did you miss this changes in the original patch then?
Yes.

================
Comment at: lib/CodeGen/CGExprScalar.cpp:2447
@@ -2443,3 +2446,3 @@
     bool isSigned = indexOperand->getType()->isSignedIntegerOrEnumerationType();
-    index = CGF.Builder.CreateIntCast(index, CGF.PtrDiffTy, isSigned,
+    index = CGF.Builder.CreateIntCast(index, DL.getIntPtrType(PtrTy), isSigned,
                                       "idx.ext");
----------------
Anastasia wrote:
> No longer ptrdiff_t?
PtrDiffTy and IntPtrTy are members of an anonymous union

  /// intptr_t, size_t, and ptrdiff_t, which we assume are the same size.
  union {
    llvm::IntegerType *IntPtrTy;
    llvm::IntegerType *SizeTy;
    llvm::IntegerType *PtrDiffTy;
  };

so they are actually the same thing. 


https://reviews.llvm.org/D23361





More information about the cfe-commits mailing list