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
- Repository
- rL LLVM
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 | ||
---|---|---|
1 ↗ | (On Diff #133464) | I do not need the whole O2 pipeline, but the verifier relies on some analysis passes to set address-taken flags to assert. I changed it to -O1. |
29 ↗ | (On Diff #133464) | Added a check to make sure blockaddress refers to the new function, m.cfi. |
llvm/test/Transforms/LowerTypeTests/blockaddr-import.ll | ||
---|---|---|
1 ↗ | (On Diff #133464) | 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 ↗ | (On Diff #133478) | It looks like this wasn't addressed. |