[llvm] [EarlyCSE] Compare GEP instructions based on offset (PR #65875)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 19 02:19:50 PDT 2023
DianQK wrote:
> > > I'm wondering, would we be able to achieve similar results if we add a `DenseMap<GetElementPtrInst *, APInt>` cache for the offset but otherwise keep the previous code structure? Or would the extra hash lookup make this slow again?
> >
> >
> > I feel like I misunderstood. Do you mean putting the GEP back into `SimpleValue`? And then create a global (or EarlyCSE only) cache value?
>
> Yes (EarlyCSE only cache). This is just a suggestion for something to check, but I suspect the performance of that approach will not be good enough and we have to go with this version.
I did not try this approach. My understanding is that this only adds extra lookups if applied to a single EarlyCSE. Since each result needs to be calculated once. The current patch is the no-hash approach as I understand it.
This result may be invalid if shared in EarlyCSE.
I made a new attempt to save uint64_t instead of APInt.
This result looks pretty good. https://llvm-compile-time-tracker.com/compare.php?from=ac1daad9bb4eb083df6b215c029816d3149e00d8&to=82f1eca7c180b0dfe8af36e933670f938a49bab1&stat=instructions%3Au
https://github.com/llvm/llvm-project/pull/65875
More information about the llvm-commits
mailing list