[llvm] ebdb0d0 - AMDGPU: During img instruction ret value construction cater for non int values

David Stuttard via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 17 01:09:30 PDT 2021


Author: David Stuttard
Date: 2021-08-17T09:08:24+01:00
New Revision: ebdb0d09a4f464417e2d916be550ab227f1b3549

URL: https://github.com/llvm/llvm-project/commit/ebdb0d09a4f464417e2d916be550ab227f1b3549
DIFF: https://github.com/llvm/llvm-project/commit/ebdb0d09a4f464417e2d916be550ab227f1b3549.diff

LOG: AMDGPU: During img instruction ret value construction cater for non int values

Make sure return type is int type.

Differential Revision: https://reviews.llvm.org/D108131

Change-Id: Ic02f07d1234cd51b6ed78c3fecd2cb1d6acd5644

Added: 
    

Modified: 
    llvm/lib/Target/AMDGPU/SIISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
index b16cf1f3bed3..9a81ada5830d 100644
--- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -5948,6 +5948,9 @@ static SDValue constructRetValue(SelectionDAG &DAG,
 
   EVT LegalReqRetVT = ReqRetVT;
   if (!ReqRetVT.isVector()) {
+    if (!Data.getValueType().isInteger())
+      Data = DAG.getNode(ISD::BITCAST, DL,
+                         Data.getValueType().changeTypeToInteger(), Data);
     Data = DAG.getNode(ISD::TRUNCATE, DL, ReqRetVT.changeTypeToInteger(), Data);
   } else {
     // We need to widen the return vector to a legal type


        


More information about the llvm-commits mailing list