The llvm.ptr.annotation and llvm.var.annotation intrinsics were changedsince the 11.0 release to add an additional parameter. This patch auto-upgrades IR containing the four-parameter versions of these intrinsics, adding a null pointer as the fifth argument.
Details
Diff Detail
Event Timeline
llvm/lib/IR/AutoUpgrade.cpp | ||
---|---|---|
3759 | since the return type of annotation didn't change i am not sure this is necessary. |
llvm/lib/IR/AutoUpgrade.cpp | ||
---|---|---|
3759 | i am not sure the bitcast is necessary. |
This looks reasonable, but the bit cast creation should be dropped, if it is not necessary.
llvm/lib/IR/AutoUpgrade.cpp | ||
---|---|---|
3759 | Yes, you're right. I was thinking about the fact that the function type changed, but that doesn't affect the return value type, so the bitcast is not needed. |
I just checked, and it appears the langref still only documents the 4 argument variants (https://llvm.org/docs/LangRef.html#llvm-ptr-annotation-intrinsic). I think those need to be updated as well?
LGTM with the additional comments & assuming passing null is safe.
llvm/lib/IR/AutoUpgrade.cpp | ||
---|---|---|
3751 | nit: might be good to add a message to the assert, like && "old version of the intrinsic took 4 arguments" | |
llvm/test/Bitcode/upgrade-ptr-annotation.ll | ||
7 | can you pass distinct arguments to the call? Otherwise we are not properly checking if we forward the correct arguments. | |
llvm/test/Bitcode/upgrade-var-annotation.ll | ||
7 | can you pass distinct arguments to the call? Otherwise we are not properly checking if we forward the correct arguments. |
nit: might be good to add a message to the assert, like && "old version of the intrinsic took 4 arguments"