[PATCH] D19677: SROA assertion: creating bitcast between ptr types with different addr spaces

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 28 12:29:57 PDT 2016


sanjoy requested changes to this revision.
This revision now requires changes to proceed.

================
Comment at: lib/Transforms/Scalar/SROA.cpp:1639
@@ -1638,3 +1638,3 @@
     if (NewTy->isPointerTy() && OldTy->isPointerTy())
-      return true;
+      return cast<PointerType>(NewTy)->getPointerAddressSpace() == cast<PointerType>(OldTy)->getPointerAddressSpace();
     if (NewTy->isIntegerTy() || OldTy->isIntegerTy())
----------------
This line is too long -- can you wrap it to 80 chars?

http://llvm.org/docs/CodingStandards.html#source-code-width

================
Comment at: test/Transforms/SROA/address-spaces-1.ll:1
@@ +1,2 @@
+; RUN: opt -O3 < %s -S
+
----------------
Given that you've filed a PR, it is better to name the test as `prXXXX.ll`.  Also don't use `-O3` here -- you should just invoke the pass you're unit testing (SROA in this case).

An easy way to do this is to use `-print-before-all` to get the IR right before SROA crashed.

================
Comment at: test/Transforms/SROA/address-spaces-1.ll:13
@@ +12,3 @@
+define void @testKernel(i32 addrspace(1)*) #0 {
+  %2 = alloca i32 addrspace(1)*, align 8
+  %3 = alloca i32, align 4
----------------
Can you shrink this test case to be more to the point?


Repository:
  rL LLVM

http://reviews.llvm.org/D19677





More information about the llvm-commits mailing list