[llvm] [AMDGPU] Don't assume a hazard for empty inline asm (PR #223526)

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 16 01:37:05 PDT 2026


xgxanq wrote:

> > I don't know what a "hazard" is, but the way to infer that an inline asm block doesn't have one is to add an annotation having the programmer promise that there is no hazard. This should not be inferred from the asm string.
> 
> The hazard would be there's some instruction inside the inline assembly which requires nops before following instructions outside of the asm. The conservatively correct thing to do is to assume the hazard is there.
> 
> IMO we should not be putting effort into enabling optimization of inline asm. It is not a good use of anyone's time and better spent not using inline asm in the first place



> > I don't know what a "hazard" is, but the way to infer that an inline asm block doesn't have one is to add an annotation having the programmer promise that there is no hazard. This should not be inferred from the asm string.
> 
> The hazard would be there's some instruction inside the inline assembly which requires nops before following instructions outside of the asm. The conservatively correct thing to do is to assume the hazard is there.
> 
> IMO we should not be putting effort into enabling optimization of inline asm. It is not a good use of anyone's time and better spent not using inline asm in the first place

Your point does make a lot of sense.

https://github.com/llvm/llvm-project/pull/223526


More information about the llvm-commits mailing list