[llvm-branch-commits] [llvm] [AMDGPU] Treat a bitcast between legal types or same-size scalars as free (PR #238412)

Matt Arsenault via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Nov 5 17:02:19 PST 2026


================
@@ -1066,6 +1066,17 @@ InstructionCost GCNTTIImpl::getCastInstrCost(unsigned Opcode, Type *Dst,
         Elts && Src->isIntegerTy(*Elts))
       return InstructionCost(MaskUnpackCostPerElt) * *Elts *
              getFullRateInstrCost();
+    // Integer and FP values share registers. The sizes differ for the parts of
+    // a split vector, and a legalized vector may need its lanes repacked.
+    if (Src->getPrimitiveSizeInBits() == Dst->getPrimitiveSizeInBits()) {
----------------
arsenm wrote:

getPrimitiveSizeInBits doesn't correctly handle pointers, 

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


More information about the llvm-branch-commits mailing list