[PATCH] D12946: Avoid pointer truncation by InstCombine with IntToPtr combining

Mehdi AMINI via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 17 16:05:27 PDT 2015


joker.eph added a comment.

This is what I expected from the previous patch, it seems backed everywhere in LLVM that functions are in address space 0. I wonder if the solution would be not to add a "code address space" to the DataLayout but rather being able to specify an address space on the function type itself.


================
Comment at: lib/Transforms/InstCombine/InstCombineCasts.cpp:1452
@@ -1451,1 +1451,3 @@
+      !CI.getType()->getPointerElementType()->isFunctionTy()) {
+    // The size of a pointer to function is not defined by any DataLayout field
     Type *Ty = DL.getIntPtrType(CI.getContext(), AS);
----------------
Put the comment before the added condition maybe?

================
Comment at: test/Transforms/InstCombine/combine-func-ptr.ll:5
@@ +4,3 @@
+;
+; CHECK: trunc
+
----------------
Shouldn't it be at CHECK-NOT?


Repository:
  rL LLVM

http://reviews.llvm.org/D12946





More information about the llvm-commits mailing list