When replacing function calls, skip call instructions where the old
function is not the called function, but e.g. the old function is passed
as an argument.
This fixes a crash due to trying to construct invalid IR for the test
case.
Differential D109759
[llvm-reduce] Skip updating calls where OldF isn't the called fn. fhahn on Sep 14 2021, 6:29 AM. Authored by
Details When replacing function calls, skip call instructions where the old This fixes a crash due to trying to construct invalid IR for the test
Diff Detail
Event TimelineComment Actions It's undefined behavior, so that's not great. But already we replace all remaining uses of the old function with a bitcast'd version of the new function, so it shouldn't make things worse much. E.g. I think even without this patch, we could have something like 'store OldF', 'load the stored fn' and call it. Or a no-op bit cast of OldF which is then passed to a call. Or a const global array which contains OldF. Those instances would have the same issue when replacing OldF with the bitcast'd version of NewF. I guess we could skip replacing functions if there are non-call users, but that might be a bit limiting in terms of reduction power. Or keep around the old function as declaration or something. |