Background: I am still working on vectorizing (widening) a whole instruction tree (from the loads to the stores). I have all scalar loads in a SetVector and have created widened version of them (new instructions).
What would be very useful to have is the possibility to get to the vector load instruction from the scalar load in constant time. I was thinking to somehow add the vector load instruction (pointer) to the scalar version as metadata. With that, the traversal of the scalar tree can quickly get the vector version of the loads. But metadata seems to work with strings of MDNodes. That makes me worry if metadata is what I want..
My question: Is metadata the only possibility to 'associate' (in the sense of making it quickly accessible) an instruction to another? What type of metadata would be recommended ?
Can you just create a hash ScalarInstruction -> WidenedInstruction? This is the way other vectorizers usually save such data.
I don’t know much about metadata, so I’ll leave this part of the question for someone else:)
Thanks for your reply, I appreciate the info how others do this. I was thinking of a hash function but was still hoping for a constant time solution
Would be great to attach/store a (user) pointer to/along with an instruction..
Sounds nice to me too. There would be many uses for a feature that
allows fast instruction associations, e.g. finding relaxations. From
what I've noticed, targets handle this sort of problem with "brute
force" switch statements.
From: "Frank Winter" <firstname.lastname@example.org>
To: "Michael Zolotukhin" <email@example.com>
Sent: Monday, July 13, 2015 2:37:00 PM
Subject: Re: [LLVMdev] Is metadata the right thing to associate one instruction to another?
Thanks for your reply, I appreciate the info how others do this. I
thinking of a hash function but was still hoping for a constant time
Hash tables give you average O(1) lookups, and I think that's as good as you're going to get. We have to guard the size of Instruction objects pretty carefully.
Would be great to attach/store a (user) pointer to/along with an
The metadata entries are not stored in the Instruction object either (except for debug metadata, but that's a hard-coded special case). For everything else, you're going through a hash table.