[Lldb-commits] [PATCH] D47551: [IRMemoryMap] Fix the alignment adjustment in Malloc
Pavel Labath via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu May 31 01:16:54 PDT 2018
labath added a comment.
I don't know much about IRMemoryMap myself, but this does seem uncontroversial. Nonetheless, I did manage to find something to rip into. :D
Comment at: source/Expression/IRMemoryMap.cpp:312-316
+ // Round up the requested size to an aligned value, if needed.
+ if (size & alignment_mask)
+ allocation_size = ((size + alignment) & (~alignment_mask));
+ allocation_size = size;
`allocation_size = llvm::alignTo(size, alignment)`
Comment at: source/Expression/IRMemoryMap.cpp:324-325
+ // reduce internal fragmentation.
+ if (alignment > 1)
+ allocation_size += alignment;
I think this should be just `allocation_size += alignment -1`. The subsequent realignment cannot eat more than `alignment-1` bytes.
More information about the lldb-commits