This is an archive of the discontinued LLVM Phabricator instance.

[X86] Use llvm::Align for passing the alignment
ClosedPublic

Authored by pengfei on Mar 12 2023, 1:28 AM.

Details

Summary

This should be a typo in emitConstantSizeRepmov. Both its caller and
callee store the alignment in a 64-bit variables, no reason to truncate
it to 32-bit. It results in alignment turns into 0 when larger than
0x100000000.

Fixes #61348

Diff Detail

Event Timeline

pengfei created this revision.Mar 12 2023, 1:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 12 2023, 1:28 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
pengfei requested review of this revision.Mar 12 2023, 1:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 12 2023, 1:28 AM
pengfei edited the summary of this revision. (Show Details)Mar 12 2023, 1:34 AM
RKSimon added inline comments.Mar 12 2023, 4:11 AM
llvm/lib/Target/X86/X86SelectionDAGInfo.cpp
208

Can we use llvm::Align instead?

pengfei updated this revision to Diff 504543.Mar 13 2023, 1:24 AM

Address review comment.

pengfei retitled this revision from [X86][NFC] Use uint64_t for passing the alignment to [X86][NFC] Use llvm::Align for passing the alignment.Mar 13 2023, 1:24 AM
pengfei marked an inline comment as done.
RKSimon accepted this revision.Mar 13 2023, 2:35 AM

LGTM - but please add the PR61348 test case as well

llvm/lib/Target/X86/X86SelectionDAGInfo.cpp
185–186

Probably worth converting this to Align Alignment as well?

This revision is now accepted and ready to land.Mar 13 2023, 2:35 AM
pengfei updated this revision to Diff 504603.Mar 13 2023, 5:28 AM
pengfei marked an inline comment as done.

Convert one more uint64_t Align into Align Alignment.

LGTM - but please add the PR61348 test case as well

I hesitate to add PR61348 test case for 3 reasons,

  1. Changing unsigned/uint64_t to Align is purely an NFC. No tests required;
  2. The origin problem can be reproduced only in assertion mode. But it doesn't make much sense to add a REQUIRES: asserts for it;
  3. The IR shouldn't generate such a large alignment. It's not reliable to test something based on it;

Let me know if you still think we should add the test case.

We have enough examples of tests with `REQUIRES: asserts``` in llvm-project\llvm\test\CodeGen\X86 that I don't think its unusual

pengfei updated this revision to Diff 504636.Mar 13 2023, 7:01 AM

Add test case.

pengfei retitled this revision from [X86][NFC] Use llvm::Align for passing the alignment to [X86] Use llvm::Align for passing the alignment.Mar 13 2023, 7:02 AM
pengfei edited the summary of this revision. (Show Details)
RKSimon accepted this revision.Mar 13 2023, 8:16 AM

LGTM - cheers

This revision was landed with ongoing or failed builds.Mar 13 2023, 9:06 AM
This revision was automatically updated to reflect the committed changes.