Could someone help me get this bug-fix into LLVM’s TOT?
CloneAndPruneFunctionInto: Fix pruned inlining when blockaddresses are present.
The issue is actually very simple: We were attempting to update
references to block address, but only the one's from blocks we had
seen so far. In PruningFunctionCloner::CloneBlock, one block
is processed at a time, in a breadth first manner. This means that
our VMap, the instruction-remapping-mechanism, is also only updated
in an identical breadth first manner. In other words, if Block X
uses the address of Block Y, and Block Y has not yet been cloned,
then your instructions in Block X that reference the address of
Block Y will not be updated (so, they will refer to the old func's
Block Y, not the new func's block Y).
llvm-fix-blockaddr.diff (5.89 KB)