For example, during RAUW in IRMover, the Function ValueAsMetadata in "CG Profile" could become bitcast.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
ping. This is relatively minor, but it still breaks some of our use cases. Does this look good?
It seems a bit odd to have/need a custom fixup for one type of MDNode here. Can visitModuleFlagCGProfileEntry be fixed to handle the bitcast?
It is indeed a bit odd but that's close to where the artifact is produced. Debug metadata nodes involving globals/functions could potentially have this issue too (either their verification doesn't enforce similar logic as CGProfile node does or they just don't care I'm not sure).
Fixing visitModuleFlagCGProfileEntry works too although it addresses the consumer rather than the producer, which logically also seems odd. If this is the preferred method to address the issue, I have no strong opinion against it.
Barring other issues from the way the metadata nodes were constructed, I guess I would prefer the change to the Verifier. It seems a bit odd to be fixing up this one metadata type here. It would be interesting to know how or why this is not an issue for the debug metadata nodes, but the fix doesn't need to wait on that.
- revert fixup in IRMover
- allow CGProfile metadata node representing edge to use bitcast.
LGTM with a couple minor changes noted below, also the description needs an update as it still references fixing up the nodes.
llvm/test/Transforms/FunctionImport/cg_profile.ll | ||
---|---|---|
2 | Comment is stale. | |
6 | I guess the test just makes sure this doesn't fail. Would be good to do a check on the output file via llvm-dis that it in fact does have the CG Profile metadata node and that it looks as expected (which I guess now will have the bitcast). |
LGTM again except for the patch title and summary which need an update. Go ahead and commit once those are updated.
Comment is stale.