[PATCH] D108863: [AMDGPU] Fix gcc 9.3.0 warning from -Wtype-limits

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 1 00:53:49 PDT 2021


foad added a reviewer: Paul-C-Anagnostopoulos.
foad added a comment.

In D108863#2975134 <https://reviews.llvm.org/D108863#2975134>, @vabridgers wrote:

> Agreed it's better to fix in the inc file. This is generated, any ideas where the source is for the generated file? Perhaps a maintainer could point me in the right direction?

The code that provokes the warning was generated by SubtargetEmitter::ParseFeaturesFunction in utils/TableGen/SubtargetEmitter.cpp. I'm not sure whether this code knows the exact type of `Attribute`, e.g. whether it's int or unsigned.

Maybe instead of:

  if (Bits[R600::FeatureLocalMemorySize0] && LocalMemorySize < 0) LocalMemorySize = 0;

it could generate:

  if (Bits[R600::FeatureLocalMemorySize0]) LocalMemorySize = std::max(LocalMemorySize, 0);

and the warning would go away?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108863/new/

https://reviews.llvm.org/D108863



More information about the llvm-commits mailing list