Fix for https://bugs.llvm.org/show_bug.cgi?id=36219: [ThinLTO] link asserts 'BA && "Refcount and block address map disagree!"'
This is similar to https://bugs.llvm.org/show_bug.cgi?id=35201: CFI: Assert triggered by LowerTypeTests
Details
Diff Detail
Event Timeline
I'd like @pcc to comment. I noticed there are a number of other places in this file where we will still be calling replaceAllUsesWith on a Function. How do we know which should use which method?
We need to use replaceUsesExceptBlockAddr if the function that we are replacing is a function definition. As far as I can tell, in all other cases we are replacing function declarations.
llvm/test/ThinLTO/X86/blockaddr-import.ll | ||
---|---|---|
2 ↗ | (On Diff #133240) | Can this be written as an IR-level test of the pass? See for example llvm/test/Transforms/LowerTypeTests/import-icall.ll. |
llvm/test/Transforms/LowerTypeTests/blockaddr-import.ll | ||
---|---|---|
2 | Looks like having the check to make sure the new function is used in blockaddress might be sufficient. I'll take out the -O option. |
llvm/test/Transforms/LowerTypeTests/Inputs/blockaddr-import.yaml | ||
---|---|---|
2–6 | It looks like this wasn't addressed. |
I think you can remove this part.