[PATCH] [Verifier] Assert gc_relocate always return a pointer type

Chen Li meloli87 at gmail.com
Mon May 11 23:18:27 PDT 2015


Hi sanjoy, reames, pgavlin, AndyAyers,

Add an assertion in verifier.cpp to make sure gc_relocate always return a pointer type

http://reviews.llvm.org/D9695

Files:
  lib/IR/Verifier.cpp

Index: lib/IR/Verifier.cpp
===================================================================
--- lib/IR/Verifier.cpp
+++ lib/IR/Verifier.cpp
@@ -3385,7 +3385,11 @@
            &CI);
 
     // gc_relocate does not need to be the same type as the relocated pointer.
-    // It can casted to the correct type later if it's desired
+    // It can casted to the correct type later if it's desired. However, it
+    // must be a pointer type
+    Assert(CI.getType()->isPointerTy(),
+	   "gc.relocate: relocating a pointer should always return a pointer", &CI);
+
     break;
   }
   };

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9695.25553.patch
Type: text/x-patch
Size: 583 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150512/dcd96566/attachment.bin>


More information about the llvm-commits mailing list