[llvm] [AMDGPU] Fix canonicalization of truncated values. (PR #83054)

Harald van Dijk via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 26 16:33:02 PST 2024


hvdijk wrote:

My first attempt for this, special casing `FP_ROUND` operands, worked for the tests we had, but not in the general case, because it did not take into account that we may have nodes that will later be optimized to just `FP_ROUND`. What this second attempt does is, if we determine that an operand is already canonicalized, keep track of whether we saw any `FP_ROUND` with `TRUNC=1`. If we did, then we can still optimize `FCANONICALIZE` to a no-op by inserting a `FREEZE` node to block optimizations. This should be correct in all cases and avoids redundant recanonicalizations in the most common cases, but as the test updates show, does not avoid redundant recanonicalizations in all cases. I will attempt to update this further.

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


More information about the llvm-commits mailing list