[PATCH] D88876: [AMDGPU] Fix gcc warnings

Sebastian Neubauer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 6 01:48:43 PDT 2020


Flakebi created this revision.
Flakebi added a reviewer: uabelho.
Herald added subscribers: llvm-commits, kerbowa, hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl, arsenm.
Herald added a project: LLVM.
Flakebi requested review of this revision.
Herald added a subscriber: wdng.

uint8_t types are implicitly promoted to int, leading to a
unsigned-signed comparison.

Thanks for the heads-up @uabelho.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88876

Files:
  llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp


Index: llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
@@ -3942,8 +3942,10 @@
       // derivatives dx/dh and dx/dv are packed with undef.
       if (((I + 1) >= EndIdx) ||
           ((Intr->NumGradients / 2) % 2 == 1 &&
-           (I == Intr->GradientStart + (Intr->NumGradients / 2) - 1 ||
-            I == Intr->GradientStart + Intr->NumGradients - 1)) ||
+           (I == static_cast<unsigned>(Intr->GradientStart +
+                                       (Intr->NumGradients / 2) - 1) ||
+            I == static_cast<unsigned>(Intr->GradientStart +
+                                       Intr->NumGradients - 1))) ||
           // Check for _L to _LZ optimization
           !MI.getOperand(ArgOffset + I + 1).isReg()) {
         PackedAddrs.push_back(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88876.296379.patch
Type: text/x-patch
Size: 932 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201006/39e6e5ec/attachment.bin>


More information about the llvm-commits mailing list