-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Open
Labels
Description
| Bugzilla Link | 11412 |
| Version | trunk |
| OS | Linux |
| CC | @efriedma-quic,@zygoloid |
Extended Description
This is a copy of part of std::vector's _M_insert_aux, the function that causes v.push_back(4) to not get inlined.
define i8* @test(i8* %ptr, i8* %ptr2) {
%A = getelementptr inbounds i8* %ptr, i64 -1
%B = ptrtoint i8* %A to i64
%C = ptrtoint i8* %ptr2 to i64
%D1 = sub i64 %C, %B
%F = getelementptr inbounds i8* %ptr, i64 %D1
ret i8* %F
}
If we prevent instcombine from forming overflow intrinsics (no PR# but those block us from getting this far), we get the above sequence. Stop me if I'm wrong but that's:
%F = ptr + ( (ptr2) - (ptr - 1) )
= ptr + ptr2 - ptr + 1
= ptr2 + 1
= getelementptr inbounds i8* %ptr2, i64 1
Probably instcombine should go get that, maybe reassociate.