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

Harald van Dijk via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 6 03:20:44 PST 2024


================
@@ -12574,6 +12595,9 @@ bool SITargetLowering::isCanonicalized(SelectionDAG &DAG, SDValue Op,
     return false;
 
   case ISD::BITCAST:
+    // TODO: This is incorrect as it loses track of the operand's type. We may
+    // end up effectively bitcasting from f32 to v2f16 or vice versa, and the
+    // same bits that are canonicalized in one type need not be in the other.
----------------
hvdijk wrote:

I think rather than give up, we should add a parameter specifying the type so that we would be able to handle things like `v2f16` -> `i32` -> truncate to `i16` -> `f16`. But yes, separate patch, this is a pre-existing issue.

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


More information about the llvm-commits mailing list