[PATCH] D70714: [Attributor] Deduce dereferenceable based on accessed bytes map
Hideto Ueno via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 26 23:56:20 PST 2019
uenoku marked 2 inline comments as done.
uenoku added inline comments.
================
Comment at: llvm/include/llvm/Transforms/IPO/Attributor.h:1829
+ /// std::map is used because we want to iterate keys in ascending order.
+ std::map<int64_t, int64_t> AccessedBytesMap;
+
----------------
jdoerfert wrote:
> Could we do uint64_t?
`<int64_t, uint64_t>` is fine but `<uint64_t, uint64_t>` is not good considering minus offset.
================
Comment at: llvm/include/llvm/Transforms/IPO/Attributor.h:1885
+ void addAccessedBytes(int64_t Offset, int64_t Size) {
+ AccessedBytesMap[Offset] = std::max(AccessedBytesMap[Offset], Size);
+
----------------
jdoerfert wrote:
> uenoku wrote:
> > jdoerfert wrote:
> > > Why std::max? I thought the map holds `<offset, size>` entries.
> > I want to handle these cases:
> > ```
> > void f(int *A){
> > double *B = (double*)A;
> > *B = 0.0;
> > *A = 0;
> > }
> > void g(int *A){
> > double *B = (double*)A;
> > *A = 0;
> > *B = 0.0;
> > }
> > ```
> Makes sense! I think I was just tired and didn't read the code properly. Can you add this as a test case?
OK, I'll add it.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70714/new/
https://reviews.llvm.org/D70714
More information about the llvm-commits
mailing list