This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Use gcc pragmas to disable -Wtype-limits warning
Needs ReviewPublic

Authored by vabridgers on Aug 28 2021, 3:58 AM.

Details

Reviewers
foad
Summary

Use gcc pragmas to disable warning in generated file. This is producing
a warning when using using gcc 9.3.0.

lib/Target/AMDGPU/R600GenSubtargetInfo.inc:282:62: warning: comparison
of unsigned expression < 0 is always false [-Wtype-limits]

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

Diff Detail

Event Timeline

vabridgers created this revision.Aug 28 2021, 3:58 AM
vabridgers requested review of this revision.Aug 28 2021, 3:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 28 2021, 3:58 AM
vabridgers edited the summary of this revision. (Show Details)Aug 28 2021, 4:00 AM

Any chance we could fix AMDGPUGenSubtargetInfo.inc instead of wrapping it in pragmas?

t-tye added a comment.Aug 30 2021, 6:30 PM

If LocalMemorySize is unsigned, how can it ever be less than 0? Shouldn't the code be corrected instead of adding pragmas?

Agreed it's better to fix in the source. The inc files are generated. Anyone know where to fix it?

arsenm added a comment.Sep 2 2021, 7:23 PM

I don't see much reason to have FeatureLocalMemorySize0. It's implied by the absence of the features with a size. I think just removing it should work

arsenm added a comment.Sep 2 2021, 7:43 PM

I don't see much reason to have FeatureLocalMemorySize0. It's implied by the absence of the features with a size. I think just removing it should work

I tired this in 79bcd4a7db29e6b0abd60b44ee825f0d49d4f36a, so that should just avoid emitting this in the first place