| Issue |
181249
|
| Summary |
[libc++] Try applying __builtin_assume_separate_storage to std::vector's this and its allocated storage
|
| Labels |
libc++,
performance
|
| Assignees |
|
| Reporter |
ldionne
|
From https://github.com/llvm/llvm-project/pull/180288:
> [...] In this case, we could add a `__builtin_assume_separate_storage(__begin_, this);` instead, which gives the optimizer the information to do the fold itself. I'm sure with this it will find more cases like the one here than if we do the optimization manually. I of course can't tell you whether we should do this, since assumes can block other optimizations, but I think we should at least look into it.
Inside `std::vector`, the `this` pointer and the `__begin_` pointer always definitely point to different objects. Telling the compiler could potentially lead to interesting optimizations. However, we should do due diligence and make sure it doesn't make things worse. I would suggest the following steps:
- [ ] Add `__builtin_assume_separate_storage(__begin_, this);`
- [ ] Run the microbenchmarks
- [ ] Run SPEC
- [ ] Run any other large scale testing we might be able to get our hands on
- [ ] Make a decision!
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs