Optimizations passes can remove GEP with offset=0 and amdgpu.uniform,
but they are less likely to drop amdgpu.uniform from a load.
This is the only way to have uniform loads without GEP or when GEP is
I'm not sure I understand the problem this is solving. Why is it dropped specifically if it is 0? If the offset is constant the GEP is uniform iff the base pointer is uniform
ConstantInt::get is simpler
You don't need the explicit Twine, you could also preserve the original name
This test should run the IR pass and check that
This makes no sense to me. amdgpu.uniform is about whether the value could differ between threads in a wave. How often the value is used further downstream is irrelevant for that.
Just put "" instead of Twine("").
Not sure about preserving the original name here -- we're not transforming an instruction here, we're adding an intermediate instruction.
Running opt -amdgpu-annotate-uniform is potentially more stable against random changes in unrelated passes.
In this particular case though, I think using llc is justified, because we do need to test that the uniform annotation actually survives through to codegen.