[llvm] [AMDGPU] Try to reuse in v_cndmask register with constant from compare. (PR #131146)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 18 02:28:43 PDT 2025
jayfoad wrote:
> > Is this going to match `X == +0.0 ? X : Y` -> `X == +0.0 ? +0.0 : Y`? That would be wrong, because if X is -0.0 then the first one evaluates to -0.0 and the second one evaluates to +0.0.
>
> `X == Const ? X : Y -> X == Const ? Const : Y` optimisation is performed in InstCombine on llvm ir. Here I try to dial with cases it can degrade performance.
>
> I double-checked the case `X == +0.0 ? X : Y` and actually InstCombine doesn't touch such operations and doesn't transform in to `X == +0.0 ? +0.0 : Y`, so there is no such issue.
OK, so InstCombine is not broken, but _this_ patch will try to do the equivalent transformation, so _this_ patch is broken.
https://github.com/llvm/llvm-project/pull/131146
More information about the llvm-commits
mailing list