[MemCpyOpt] Fix the invalid code modification for GEP#68479
Conversation
nikic
left a comment
There was a problem hiding this comment.
Instead of rolling back, we should not do the change until we know the transform will succeed. The simplest way to do that would be to move this check to the end. (Setting a variable to perform the move later would also work.)
@nikic According to this modification(https://reviews.llvm.org/D89623), which claim that "When performing a call slot optimization to a GEP dest, it will currently usually not apply, because the GEP is directly before the memcpy and as such does not dominate the call. We should move it above the call if that satisfies the domination requirement." It seems that it is better to apply this move before some further checks. Is it proper to do RAII for GEP inst instead of roll back? |
ff0f90f to
a6cd812
Compare
The further checks do not depend on the instruction being moved. It just needs to be moved at some point if the transform is applied, it does not have to be at that specific place in the sequence of checks. |
a6cd812 to
ee996e2
Compare
602591c to
40084e5
Compare
please update commit message too. |
Relocate the GEP modification to a later stage of the function performCallSlotOption, ensuring that the code remains unchanged if the optimization fails.
40084e5 to
ab78cf1
Compare
Relocate the GEP modification to a later stage of the function performCallSlotOption, ensuring that the code remains unchanged if the optimization fails.