On Mon, Mar 21, 2022 at 11:56 AM Erick Ochoa <eoc...@gcc.gnu.org> wrote: > > Hi, > > I am interested in annotating INTEGER_CSTs. I have added a field to > typed_trees and set the value in some cases. However, INTEGER_CSTs can be > shared and copied across the function and even copied to other functions. I > don't want all INTEGER_CSTs with the same value to be shared as now they have > an annotation which may make them somewhat unique. My question is, is there a > way to disable sharing of INTEGER_CSTs?
Not really. There's a special "kind" of INTEGER_CSTs not shared, those with TREE_OVERFLOW set. But I'd advise against un-sharing of INTEGER_CSTs, can't you annotate sth higher level up? > > I have tried modifying tree_node_can_be_shared to return false when the > argument is an INTEGER_CST. However, the verifier then fails stating that > there was an incorrect sharing of tree nodes. My intuition tells me that this > means that some pass assumes that INTEGER_CSTs can be shared and therefore > the information gets copied. However, during the verifier this gets caught > and returns an error. Is this correct? How would one go around and disable > sharing INTEGER_CSTs? > > Is there a tree comparison for INTEGER_CSTs that I can set such that if an > INTEGER_CST has my field set then it registers as a different INTEGER_CST > even if they have the same constant value? > > Thanks!