ahatanak added a subscriber: ahatanak.
ahatanak added a comment.

I'm wondering what the status of this patch is since someone has asked us to 
add support for this attribute in clang. Are you still waiting for review?


================
Comment at: test/CodeGenCXX/alloc-size.cpp:66
@@ +65,3 @@
+  // CHECK: ret i32 122
+  return __builtin_object_size(my_malloc<int>(), 0) +
+         __builtin_object_size(my_calloc<int>(5), 0) +
----------------
Is it necessary to compute __builtin_object_size in the front-end (rather than 
in some IR passes like instcombine) when it takes the pointer returned by a 
function marked alloc_size?

Also, is the IR optimization smart enough to get the exact object size in the 
following case?

```
void foo(int a, int b) {
  void *p0 = my_malloc(a);
  g0 = __builtin_object_size(p0, 0);
  void *p1 = my_calloc(a, b);
  g1 = __builtin_object_size(p1, 1);
}

void foo1() {
  foo(10, 50);
}
```


https://reviews.llvm.org/D14274



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to