This is an archive of the discontinued LLVM Phabricator instance.

Require "target datalayout" to be at the beginning of an IR file.
ClosedPublic

Authored by efriedma on Apr 17 2020, 7:36 PM.

Details

Summary

This will allow us to use the datalayout to disambiguate other constructs in IR, like load alignment. Split off from D78403.

Diff Detail

Event Timeline

efriedma created this revision.Apr 17 2020, 7:36 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 17 2020, 7:36 PM

LGTM.

I didn't know we had weird header infos in the middle of test files.

llvm/lib/AsmParser/LLParser.cpp
303–313

[suggestion]

while (true) {
  if (Lex.getKind() == lltok::kw_target) {
    if (ParseTargetDefinition())
      return true;
    continue;
  }

  if (Lex.getKind() == lltok::kw_source_filename) {
    if (ParseSourceFileName())
      return true;
    continue;
  } 
  
  return false;
}
mehdi_amini accepted this revision.Apr 17 2020, 9:07 PM
This revision is now accepted and ready to land.Apr 17 2020, 9:07 PM
This revision was automatically updated to reflect the committed changes.