This is an archive of the discontinued LLVM Phabricator instance.

[NFC][Alignment] Remove max functions between Align and MaybeAlign
ClosedPublic

Authored by gchatelet on Jun 18 2022, 7:37 AM.

Details

Summary

llvm::max(Align, MaybeAlign) and llvm::max(MaybeAlign, Align) are
not used often enough to be required. They also make the code more opaque.

Diff Detail

Event Timeline

gchatelet created this revision.Jun 18 2022, 7:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 18 2022, 7:37 AM
gchatelet requested review of this revision.Jun 18 2022, 7:37 AM
Herald added a reviewer: sstefan1. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
courbet added inline comments.Jun 19 2022, 10:50 PM
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
6252

Why is this OK ? I'm seeing:

if (!SimpleV.hasValue())
      return APInt(64, 0);

in getAPIInt

gchatelet marked an inline comment as done.

address comments and rebase

llvm/lib/Transforms/IPO/AttributorAttributes.cpp
6252

The assert above expects a value for alignment API and the value cannot be 0 for a valid alignment (should be at least 1).
I'll tweak the assert to make sure this is true and use assumeAligned as an extra protection.

courbet accepted this revision.Jun 20 2022, 12:55 AM
This revision is now accepted and ready to land.Jun 20 2022, 12:55 AM
This revision was landed with ongoing or failed builds.Jun 20 2022, 1:38 AM
This revision was automatically updated to reflect the committed changes.