This is an archive of the discontinued LLVM Phabricator instance.

[Alignment][NFC] Use Align for TargetCallingConv::OrigAlign
ClosedPublic

Authored by gchatelet on Jun 22 2020, 8:28 AM.

Details

Summary

This patch replaces D69249.

This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Diff Detail

Event Timeline

gchatelet created this revision.Jun 22 2020, 8:28 AM

I see several places that never call setOrigAlign(), e.g. in GlobalISel CallLowering:

ISD::ArgFlagsTy Flags = OrigFlags;
            if (Part == 0) {
              Flags.setSplit();
            } else {
              Flags.setOrigAlign(Align(1));
              if (Part == NumParts - 1)
                Flags.setSplitEnd();
            }
            Args[i].Regs.push_back(Reg);
            Args[i].Flags.push_back(Flags);

How did you infer that this change was safe ?

gchatelet updated this revision to Diff 272713.Jun 23 2020, 7:17 AM
  • Make OrigAlign defaults to Align(1)

I see several places that never call setOrigAlign(), e.g. in GlobalISel CallLowering:

ISD::ArgFlagsTy Flags = OrigFlags;
            if (Part == 0) {
              Flags.setSplit();
            } else {
              Flags.setOrigAlign(Align(1));
              if (Part == NumParts - 1)
                Flags.setSplitEnd();
            }
            Args[i].Regs.push_back(Reg);
            Args[i].Flags.push_back(Flags);

How did you infer that this change was safe ?

So indeed, running the tests in debug mode revealed a few architectures for which OrigAlign was not set.
Namely codegen for ARM and Mips.

I looked at all the stack traces. They either use the alignment to check on some particular values and make decisions based on them (e.g. which registers to use) or passed down to AllocateStackwhich requires the alignment to be defined.

By switching the default value to Align(1) instead of None, all the tests are passing.
It is not a proof that the change is safe for sure but we're in CodeGen and alignment should be resolved at this point anyways.

OK but this changes the meaning of getOrigAlign(), which some downstream targets might depend on. What about doing this dynamically in getNonZeroOrigAlign() until getOrigAlign() is fully removed ?

gchatelet updated this revision to Diff 273278.Jun 25 2020, 2:41 AM

Address comments

OK but this changes the meaning of getOrigAlign(), which some downstream targets might depend on. What about doing this dynamically in getNonZeroOrigAlign() until getOrigAlign() is fully removed ?

I kept the original semantic for getOrigAlign as you suggested.

courbet accepted this revision.Jun 25 2020, 6:12 AM
This revision is now accepted and ready to land.Jun 25 2020, 6:12 AM
This revision was automatically updated to reflect the committed changes.