Page MenuHomePhabricator

[SystemZ][z/OS] Stricter condition for HLASM class instantiation
ClosedPublic

Authored by anirudhp on May 28 2021, 2:39 PM.

Details

Summary
  • A lot of lit tests simply specify the arch minus the triple. On z/OS, this could result in a scenario of some-other-triple-unknown-ibm-zos. This points to an incorrect triple + arch combo.
  • To prevent this, isOSzOS change is switched in favour of isOSBinFormatGOFF.
  • This is because, the GOFF format is set only if the triple is systemz and if the operating system is GOFF. And currently, there are no other architectures/os's using the GOFF file format.
  • An argument could be made that the problematic tests be fixed to explicitly specify the arch-vendor-triple string, but there's a large number of these tests, and adding this stricter scope ensures that we aren't instantiating the incorrect instance of the AsmParser for other platforms when run on z/OS.

Diff Detail

Event Timeline

anirudhp created this revision.May 28 2021, 2:39 PM
anirudhp requested review of this revision.May 28 2021, 2:39 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 28 2021, 2:39 PM

Maybe it would be clearer to be explicit and write:

if (C.getTargetTriple().isSystemZ() && C.getTargetTriple().isOSzOS())

This should have the same effect but avoid the implicit assumptions.

Maybe it would be clearer to be explicit and write:

if (C.getTargetTriple().isSystemZ() && C.getTargetTriple().isOSzOS())

This should have the same effect

Yes, that would be the same behaviour.

but avoid the implicit assumptions.

Are we making an implicit assumption? In the getDefaultFormat function in Triple.cpp, we have:

case Triple::systemz:
  if (T.isOSzOS())
    return Triple::GOFF;

GOFF is only set when the arch is systemz and the os is zos.

Maybe it would be clearer to be explicit and write:

if (C.getTargetTriple().isSystemZ() && C.getTargetTriple().isOSzOS())

This should have the same effect

Yes, that would be the same behaviour.

but avoid the implicit assumptions.

Are we making an implicit assumption? In the getDefaultFormat function in Triple.cpp, we have:

case Triple::systemz:
  if (T.isOSzOS())
    return Triple::GOFF;

GOFF is only set when the arch is systemz and the os is zos.

That's true now. The "implicit assumption" is that this will never change in the future.

anirudhp updated this revision to Diff 348814.May 31 2021, 8:42 AM
  • More explicit check which eliminates implicit assumptions

That's true now. The "implicit assumption" is that this will never change in the future.

Changed.

uweigand accepted this revision.May 31 2021, 9:07 AM

LGTM, thanks!

This revision is now accepted and ready to land.May 31 2021, 9:07 AM