Can a Constant have more than one use?

As the question asks. IIRC, I have only seen constants use to:

  1. setup globals
  2. as “constant parameters” to instructions.

In both these cases, from what I understand, they will have a single use. Is it possible to create a Constant with multiple use(r)s?

Thanks,
Siddharth

I am nearly positive that constants can be used more than once. They subclass from Value. I am sure that you can create a test program that uses the same constant value in different places and see if it generates one ConstantInt or multiple ConstantInts for the same constant integer. Regards, John Criswell

Every instance of a particular Constant type+value should use the same object. There are uniquing maps in the LLVMContext that are checked when any of the Constant*::get methods are called. If the constant has already been created that object will be reused.

We rely on this to check equality of constants by doing only a pointer compare in many places.