[PATCH] D49624: AMDGPU/GlobalISel: Fix crash in regbankselect on non-power-of-2 types
Tom Stellard via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 20 17:02:58 PDT 2018
tstellar created this revision.
tstellar added a reviewer: arsenm.
Herald added subscribers: t-tye, tpr, dstuttard, kristof.beyls, rovka, yaxunl, nhaehnle, wdng, kzhuravl.
Repository:
rL LLVM
https://reviews.llvm.org/D49624
Files:
lib/Target/AMDGPU/AMDGPUGenRegisterBankInfo.def
test/CodeGen/AMDGPU/GlobalISel/regbankselect.mir
Index: test/CodeGen/AMDGPU/GlobalISel/regbankselect.mir
===================================================================
--- test/CodeGen/AMDGPU/GlobalISel/regbankselect.mir
+++ test/CodeGen/AMDGPU/GlobalISel/regbankselect.mir
@@ -14,6 +14,7 @@
%tmp2 = load i32, i32 addrspace(1)* %tmp1
ret void
}
+ define void @non_power_of_2() { ret void }
declare i32 @llvm.amdgcn.workitem.id.x() #0
attributes #0 = { nounwind readnone }
...
@@ -67,3 +68,19 @@
%0:_(p1) = COPY $sgpr0_sgpr1
%1:_(s32) = G_LOAD %0 :: (load 4 from %ir.tmp1)
...
+
+---
+name: non_power_of_2
+legalized: true
+
+# CHECK-LABEL: name: non_power_of_2
+# CHECK: [[S448:%[0-9]+]]:sgpr(s448) = G_IMPLICIT_DEF
+# CHECK: sgpr(s32) = G_EXTRACT [[S448]](s448), 0
+
+body: |
+ bb.0:
+ %0:_(s448) = G_IMPLICIT_DEF
+ %1:_(s32) = G_EXTRACT %0:_(s448), 0
+ $sgpr0 = COPY %1:_(s32)
+ SI_RETURN_TO_EPILOG $sgpr0
+...
Index: lib/Target/AMDGPU/AMDGPUGenRegisterBankInfo.def
===================================================================
--- lib/Target/AMDGPU/AMDGPUGenRegisterBankInfo.def
+++ lib/Target/AMDGPU/AMDGPUGenRegisterBankInfo.def
@@ -96,7 +96,7 @@
break;
default:
Idx = BankID == AMDGPU::VGPRRegBankID ? VGPRStartIdx : SGPRStartIdx;
- Idx += llvm::countTrailingZeros(Size);
+ Idx += Log2_32_Ceil(Size);
break;
}
return &ValMappings[Idx];
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49624.156648.patch
Type: text/x-patch
Size: 1379 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180721/6fd373e4/attachment.bin>
More information about the llvm-commits
mailing list