pcc wrote:

I would expect 

> > For example, it could be dropped from CFI jump tables and the resulting 
> > binary would still be correct, it would just be less optimized because jump 
> > table relaxation could not be applied.
> 
> Is the opposite also true, that you can add it to non-cfi-jump-table globals 
> and the resulting binary is still correct? (Unless there's some check, 
> constant merging can merge either way, I think.)

I would expect passes to refuse to merge constants with inconsistent metadata, 
as that is effectively the same as adding metadata to one of the sides, which 
is not guaranteed to result in correct behavior. I seem to recall a discussion 
about this a few years ago in the context of merging instructions, the outcome 
being that passes should not do this. Indeed, looking at ConstantMerge it does 
refuse to merge globals with non-debug metadata:

https://github.com/llvm/llvm-project/blob/e7c9f2db41900c8991f6d3172e9bf74e57c39736/llvm/lib/Transforms/IPO/ConstantMerge.cpp#L108

https://github.com/llvm/llvm-project/pull/149260
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to