[PATCH] D13737: AMDGPU: Fix asserts on invalid register ranges

Nicolai Hähnle via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 20 22:00:50 PDT 2015


nhaehnle added a subscriber: nhaehnle.

================
Comment at: lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp:543-548
@@ -542,4 +542,8 @@
     } else {
       // SGPR registers are aligned.  Max alignment is 4 dwords.
-      RegIndexInClass = RegLo / std::min(RegWidth, 4u);
+      unsigned Size = std::min(RegWidth, 4u);
+      if (RegLo % Size != 0)
+        return true;
+
+      RegIndexInClass = RegLo / Size;
     }
----------------
Nitpick: Maybe rename Size to Alignment?


http://reviews.llvm.org/D13737





More information about the llvm-commits mailing list