Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update test cases to LLVM 10.0 #132

Closed
5 of 7 tasks
mewmew opened this issue Mar 26, 2020 · 7 comments · Fixed by llir/testdata#3 or llir/testdata#6
Closed
5 of 7 tasks

update test cases to LLVM 10.0 #132

mewmew opened this issue Mar 26, 2020 · 7 comments · Fixed by llir/testdata#3 or llir/testdata#6

Comments

@mewmew
Copy link
Member

mewmew commented Mar 26, 2020

Similar steps taken to those detailed in #105.

Update of llir/testdata/llvm/Makefile:

 # LLVM version.
-VER=9.0.0
+VER=10.0.0
 
 ROOT_DIR=$(shell pwd)
 
@@ -21,7 +21,7 @@ llvm-${VER}.src: | llvm-${VER}.src.tar.xz
        tar -xJf llvm-${VER}.src.tar.xz
 
 llvm-${VER}.src.tar.xz:
-       wget -O $@ "https://releases.llvm.org/${VER}/llvm-${VER}.src.tar.xz"
+       wget -O $@ "https://github.com/llvm/llvm-project/releases/download/llvmorg-${VER}/llvm-${VER}.src.tar.xz"
        touch $@
 
 clean:

Parse errors

These requires update to the LLVM IR grammar (for inspiration, see #101 for update of grammar to LLVM 9.0)

For errors like asm_test.go:509: unable to parse "../testdata/llvm/test/Bitcode/compatibility.ll" into AST; syntax error at line 880:

Test case mismatch

Note, it is quite likely that a few of the original test cases have been updated. In these cases, we must also update our .golden file of those test cases.

For errors like asm_test.go:524: module "../testdata/llvm/test/Analysis/CostModel/AMDGPU/fdiv.ll.golden" mismatch (-want +got):

Fixed (see #132 (comment) for details)

Test cases not yet updated

Coreutils and SQLite test cases are not yet updated to LLVM 10.0. I'll do this as soon as Clang is updated to 10.0 on Arch Linux (ref: https://www.archlinux.org/packages/extra/x86_64/clang/).

  • Coreutils
  • SQLite
mewmew added a commit to mewpull/testdata that referenced this issue Mar 26, 2020
Steps taken:

1. Update VER in testdata/llvm/Makefile from 9.0.0 to 10.0.0
2. Run `make` from testdata/llvm
3. Run `./skip.sh` from testdata/llvm
4. Run `git add .` from testdata/llvm

This is just the first step to update the test cases to LLVM 10.0.

A follow-up commit will update `*.ll.golden` test cases.

And another follow-up commit will update the test cases of Coreutils
and SQLite, which requires Clang 10.0 being installed on the system.

Updates llir/llvm#132.
@mewmew
Copy link
Member Author

mewmew commented Mar 26, 2020

From commit message of 998e529f8d9adda6db834a5d796b0fe76a7809d1, these steps were followed to update the test cases to LLVM 10.0:

  1. Update VER in testdata/llvm/Makefile from 9.0.0 to 10.0.0
  2. Run make from testdata/llvm
  3. Run ./skip.sh from testdata/llvm
  4. Run git add . from testdata/llvm

This is just the first step to update the test cases to LLVM 10.0.

A follow-up commit will update *.ll.golden test cases.

And another follow-up commit will update the test cases of Coreutils
and SQLite, which requires Clang 10.0 being installed on the system.


To prepare for the first follow-up commit, these steps were taken.

Firstly, since LLVM 10.0 made a change to the representation of function parameters (see #131 for details) - with previously "unnamed" params now always being assigned a name (e.g. %0) instead of remaining anonymous - almost every golden test case requires updates.

Most of the test cases have not added any new contents however, so for the majority of the test golden test, the change is simple; e.g. "add %0, %1 as param names" .

To automate this process as much as possible, this hack was used (temporary change to asm/asm_test.go):

 if osutil.Exists(g.path + ".golden") {
 	path = g.path + ".golden"
 }
 buf, err := ioutil.ReadFile(path)
 if err != nil {
 	t.Errorf("unable to read %q; %+v", path, err)
 	continue
 }
 want := string(buf)
 got := m.String()
 if want != got {
 	if err := diffutil.Diff(want, got, words, filepath.Base(path)); err != nil {
 		panic(err)
 	}
+	if strings.HasSuffix(path, ".golden") {
+		if err := ioutil.WriteFile(path, []byte(got), 0644); err != nil {
+			panic(err)
+		}
+	}
+	// TODO: remove this hack (used to batch update *ll..golden files after the
+	// named "unnamed" parameter change landed in LLVM 10.0, virtually forcing an
+	// update of _all_ test cases).

After this, we ran go test ./... to regenerate the golden test cases using the aforementioned hack.

With the golden test cases regenerated, we have to manually review them, to ensure that the change is either trivial (by double-checking the corresponding change in foo.ll for foo.ll.golden) or verifying that the change is strictly related to unnamed parameters. To do these checks, we relied extensively on git diff --color-words.

For instance:

git diff --color-words Assembler/2002-08-16-ConstExprInlined.ll.golden
diff --git a/llvm/test/Assembler/2002-08-16-ConstExprInlined.ll.golden b/llvm/test/Assembler/2002-08-16-ConstExprInlined.ll.golden
index 5344362f..8a255541 100644
--- a/llvm/test/Assembler/2002-08-16-ConstExprInlined.ll.golden
+++ b/llvm/test/Assembler/2002-08-16-ConstExprInlined.ll.golden
@@ -1,7 +1,7 @@
@.LC0 = internal global [4 x i8] c"foo\00"
@X = global i8* null

declare i32 @puts(i8*)@puts(i8* %0)

define void @main() {
bb1:

This helped us generate the following list of categories of changes:

Note a few trivial changes with added contents were included in the category named "unnamed" function parameters. If the added contents was a large change however, they are handled separately, and added to their dedicated category new content.

content removed

Golden test cases fixed in rev llir/testdata@622da56.

  • Assembler/debug-info.ll.golden
  • DebugInfo/Generic/constant-pointers.ll.golden

new content

The update of Transforms/InstCombine/fma.ll.golden helped highlight a bug in the round-trip of double-precision floating-point values. Before we update this test case to LLVM 10.0, issue #133 should be resolved.

named "unnamed" function parameters

Golden test cases fixed in rev llir/testdata@f9a0b00.

  • Analysis/BasicAA/pr18573.ll.golden
  • Assembler/2002-03-08-NameCollision.ll.golden
  • Assembler/2002-08-16-ConstExprInlined.ll.golden
  • Assembler/2007-07-19-ParamAttrAmbiguity.ll.golden
  • Assembler/2007-09-10-AliasFwdRef.ll.golden
  • Assembler/2009-03-24-ZextConstantExpr.ll.golden
  • Assembler/2010-02-05-FunctionLocalMetadataBecomesNull.ll.golden
  • Assembler/auto_upgrade_nvvm_intrinsics.ll.golden
  • Assembler/block-labels.ll.golden
  • Assembler/debug-label-bitcode.ll.golden
  • Assembler/drop-debug-info-nonzero-alloca.ll.golden
  • Assembler/fast-math-flags.ll.golden
  • Assembler/incorrect-tdep-attrs-parsing.ll.golden
  • Assembler/metadata-function-local.ll.golden
  • Assembler/metadata.ll.golden
  • Assembler/musttail.ll.golden
  • Assembler/token.ll.golden
  • Assembler/unnamed-addr.ll.golden
  • Bitcode/disubrange.ll.golden
  • CodeGen/X86/extractps.ll.golden
  • Assembler/auto_upgrade_intrinsics.ll.golden
  • DebugInfo/ARM/selectiondag-deadcode.ll.golden
  • DebugInfo/Generic/debug-label-mi.ll.golden
  • DebugInfo/Generic/debug-names-linkage-name.ll.golden
  • DebugInfo/X86/debug-ranges-offset.ll.golden
  • DebugInfo/X86/dw_op_minus.ll.golden
  • DebugInfo/X86/objc-property-void.ll.golden
  • DebugInfo/X86/safestack-byval.ll.golden
  • DebugInfo/X86/sdag-combine.ll.golden
  • DebugInfo/X86/stack-value-dwarf2.ll.golden
  • DebugInfo/debugify-bogus-dbg-value.ll.golden
  • DebugInfo/debugify-report-missing-locs-only.ll.golden
  • Feature/OperandBundles/basic-aa-argmemonly.ll.golden
  • Feature/OperandBundles/dse.ll.golden
  • Feature/attributes.ll.golden
  • Feature/basictest.ll.golden
  • Feature/forwardreftest.ll.golden
  • Feature/indirectcall.ll.golden
  • Feature/intrinsics.ll.golden
  • Feature/memorymarkers.ll.golden
  • Feature/metadata.ll.golden
  • Feature/paramattrs.ll.golden
  • Feature/prototype.ll.golden
  • Feature/recursivetype.ll.golden
  • Feature/testconstants.ll.golden
  • Feature/testvarargs.ll.golden
  • Feature/undefined.ll.golden
  • Feature/varargs.ll.golden
  • Feature/varargs_new.ll.golden
  • Transforms/InstSimplify/compare.ll.golden
  • Transforms/LoopUnswitch/callbr.ll.golden
  • Transforms/InstCombine/vec_demanded_elts.ll.golden

mewmew added a commit to mewpull/testdata that referenced this issue Mar 26, 2020
This change updates the golden test cases that either had a trivial
change of contents or had strictly the unnamed parameter change as
referenced in PR llir/llvm#131.

See llir/llvm#132 (comment)
for further details.
@mewmew
Copy link
Member Author

mewmew commented Mar 26, 2020

To facilitate testing and integration of the new LLVM 10.0 test cases, commit 5aaf037. was temporarily reverted locally. For anyone updating test cases to new versions of LLVM in the future, consider this as a subtle life improvement hint ;)

mewmew added a commit to llir/testdata that referenced this issue Mar 26, 2020
* llvm: update test cases to LLVM 10.0

Steps taken:

1. Update VER in testdata/llvm/Makefile from 9.0.0 to 10.0.0
2. Run `make` from testdata/llvm
3. Run `./skip.sh` from testdata/llvm
4. Run `git add .` from testdata/llvm

This is just the first step to update the test cases to LLVM 10.0.

A follow-up commit will update `*.ll.golden` test cases.

And another follow-up commit will update the test cases of Coreutils
and SQLite, which requires Clang 10.0 being installed on the system.

Updates llir/llvm#132.

* llvm: update golden test cases to LLVM 10.0

This change updates the golden test cases that either had a trivial
change of contents or had strictly the unnamed parameter change as
referenced in PR llir/llvm#131.

See llir/llvm#132 (comment)
for further details.

* llvm: update golden test cases to LLVM 10.0

This change updates golden test cases that removed contents between 9.0
and 10.0.

The change in both cases is trival.

* llvm: update Feature/fp-intrinsics.ll golden test case to LLVM 10.0

A little new contents was added and unnamed parameters were assigned
names per LLVM 10.0 convention.

* llvm: update Analysis/CostModel/AMDGPU/fdiv.ll golden test case to LLVM 10.0

A little new contents was added and unnamed parameters were assigned
names per LLVM 10.0 convention.
@mewmew mewmew reopened this Mar 26, 2020
@mewmew
Copy link
Member Author

mewmew commented Mar 26, 2020

PR llir/testdata#3 fixed most but not all test cases.

@dannypsnl
Copy link
Member

dannypsnl commented Apr 7, 2020

Compare ASM parser changes:

$ wget https://github.com/llvm/llvm-project/archive/llvmorg-9.0.1.tar.gz
$ wget https://github.com/llvm/llvm-project/archive/llvmorg-10.0.0.tar.gz
$ tar zxf llvmorg-9.0.1.tar.gz
$ tar zxf llvmorg-10.0.0.tar.gz
$ git diff llvm-project-llvmorg-9.0.1/llvm/lib/AsmParser llvm-project-llvmorg-10.0.0/llvm/lib/AsmParser
diff --git a/llvm-project-llvmorg-9.0.1/llvm/lib/AsmParser/CMakeLists.txt b/llvm-project-llvmorg-10.0.0/llvm/lib/AsmParser/CMakeLists.txt
index 0d72723..a501956 100644
--- a/llvm-project-llvmorg-9.0.1/llvm/lib/AsmParser/CMakeLists.txt
+++ b/llvm-project-llvmorg-10.0.0/llvm/lib/AsmParser/CMakeLists.txt
@@ -1,5 +1,5 @@
 # AsmParser
-add_llvm_library(LLVMAsmParser
+add_llvm_component_library(LLVMAsmParser
   LLLexer.cpp
   LLParser.cpp
   Parser.cpp
diff --git a/llvm-project-llvmorg-9.0.1/llvm/lib/AsmParser/LLLexer.cpp b/llvm-project-llvmorg-10.0.0/llvm/lib/AsmParser/LLLexer.cpp
index 72d2357..d96b5e0 100644
--- a/llvm-project-llvmorg-9.0.1/llvm/lib/AsmParser/LLLexer.cpp
+++ b/llvm-project-llvmorg-10.0.0/llvm/lib/AsmParser/LLLexer.cpp
@@ -585,6 +585,7 @@ lltok::Kind LLLexer::LexIdentifier() {
   KEYWORD(ccc);
   KEYWORD(fastcc);
   KEYWORD(coldcc);
+  KEYWORD(cfguard_checkcc);
   KEYWORD(x86_stdcallcc);
   KEYWORD(x86_fastcallcc);
   KEYWORD(x86_thiscallcc);
@@ -593,6 +594,7 @@ lltok::Kind LLLexer::LexIdentifier() {
   KEYWORD(arm_aapcscc);
   KEYWORD(arm_aapcs_vfpcc);
   KEYWORD(aarch64_vector_pcs);
+  KEYWORD(aarch64_sve_vector_pcs);
   KEYWORD(msp430_intrcc);
   KEYWORD(avr_intrcc);
   KEYWORD(avr_signalcc);
@@ -622,6 +624,7 @@ lltok::Kind LLLexer::LexIdentifier() {
   KEYWORD(amdgpu_ps);
   KEYWORD(amdgpu_cs);
   KEYWORD(amdgpu_kernel);
+  KEYWORD(tailcc);
 
   KEYWORD(cc);
   KEYWORD(c);
@@ -748,6 +751,7 @@ lltok::Kind LLLexer::LexIdentifier() {
   KEYWORD(noRecurse);
   KEYWORD(returnDoesNotAlias);
   KEYWORD(noInline);
+  KEYWORD(alwaysInline);
   KEYWORD(calls);
   KEYWORD(callee);
   KEYWORD(hotness);
@@ -891,6 +895,8 @@ lltok::Kind LLLexer::LexIdentifier() {
   INSTKEYWORD(catchpad,     CatchPad);
   INSTKEYWORD(cleanuppad,   CleanupPad);
 
+  INSTKEYWORD(freeze,       Freeze);
+
 #undef INSTKEYWORD
 
 #define DWKEYWORD(TYPE, TOKEN)                                                 \
diff --git a/llvm-project-llvmorg-9.0.1/llvm/lib/AsmParser/LLParser.cpp b/llvm-project-llvmorg-10.0.0/llvm/lib/AsmParser/LLParser.cpp
index 87dff64..1a17f63 100644
--- a/llvm-project-llvmorg-9.0.1/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm-project-llvmorg-10.0.0/llvm/lib/AsmParser/LLParser.cpp
@@ -1122,7 +1122,7 @@ bool LLParser::ParseGlobal(const std::string &Name, LocTy NameLoc,
       if (ParseToken(lltok::StringConstant, "expected partition string"))
         return true;
     } else if (Lex.getKind() == lltok::kw_align) {
-      unsigned Alignment;
+      MaybeAlign Alignment;
       if (ParseOptionalAlignment(Alignment)) return true;
       GV->setAlignment(Alignment);
     } else if (Lex.getKind() == lltok::MetadataVar) {
@@ -1229,12 +1229,13 @@ bool LLParser::ParseFnAttributeValuePairs(AttrBuilder &B,
       // As a hack, we allow function alignment to be initially parsed as an
       // attribute on a function declaration/definition or added to an attribute
       // group and later moved to the alignment field.
-      unsigned Alignment;
+      MaybeAlign Alignment;
       if (inAttrGrp) {
         Lex.Lex();
-        if (ParseToken(lltok::equal, "expected '=' here") ||
-            ParseUInt32(Alignment))
+        uint32_t Value = 0;
+        if (ParseToken(lltok::equal, "expected '=' here") || ParseUInt32(Value))
           return true;
+        Alignment = Align(Value);
       } else {
         if (ParseOptionalAlignment(Alignment))
           return true;
@@ -1603,7 +1604,7 @@ bool LLParser::ParseOptionalParamAttrs(AttrBuilder &B) {
       continue;
     }
     case lltok::kw_align: {
-      unsigned Alignment;
+      MaybeAlign Alignment;
       if (ParseOptionalAlignment(Alignment))
         return true;
       B.addAlignmentAttr(Alignment);
@@ -1635,6 +1636,7 @@ bool LLParser::ParseOptionalParamAttrs(AttrBuilder &B) {
     case lltok::kw_nest:            B.addAttribute(Attribute::Nest); break;
     case lltok::kw_noalias:         B.addAttribute(Attribute::NoAlias); break;
     case lltok::kw_nocapture:       B.addAttribute(Attribute::NoCapture); break;
+    case lltok::kw_nofree:          B.addAttribute(Attribute::NoFree); break;
     case lltok::kw_nonnull:         B.addAttribute(Attribute::NonNull); break;
     case lltok::kw_readnone:        B.addAttribute(Attribute::ReadNone); break;
     case lltok::kw_readonly:        B.addAttribute(Attribute::ReadOnly); break;
@@ -1720,7 +1722,7 @@ bool LLParser::ParseOptionalReturnAttrs(AttrBuilder &B) {
       continue;
     }
     case lltok::kw_align: {
-      unsigned Alignment;
+      MaybeAlign Alignment;
       if (ParseOptionalAlignment(Alignment))
         return true;
       B.addAlignmentAttr(Alignment);
@@ -1920,6 +1922,7 @@ void LLParser::ParseOptionalDLLStorageClass(unsigned &Res) {
 ///   ::= 'fastcc'
 ///   ::= 'intel_ocl_bicc'
 ///   ::= 'coldcc'
+///   ::= 'cfguard_checkcc'
 ///   ::= 'x86_stdcallcc'
 ///   ::= 'x86_fastcallcc'
 ///   ::= 'x86_thiscallcc'
@@ -1928,6 +1931,7 @@ void LLParser::ParseOptionalDLLStorageClass(unsigned &Res) {
 ///   ::= 'arm_aapcscc'
 ///   ::= 'arm_aapcs_vfpcc'
 ///   ::= 'aarch64_vector_pcs'
+///   ::= 'aarch64_sve_vector_pcs'
 ///   ::= 'msp430_intrcc'
 ///   ::= 'avr_intrcc'
 ///   ::= 'avr_signalcc'
@@ -1955,6 +1959,7 @@ void LLParser::ParseOptionalDLLStorageClass(unsigned &Res) {
 ///   ::= 'amdgpu_ps'
 ///   ::= 'amdgpu_cs'
 ///   ::= 'amdgpu_kernel'
+///   ::= 'tailcc'
 ///   ::= 'cc' UINT
 ///
 bool LLParser::ParseOptionalCallingConv(unsigned &CC) {
@@ -1963,6 +1968,7 @@ bool LLParser::ParseOptionalCallingConv(unsigned &CC) {
   case lltok::kw_ccc:            CC = CallingConv::C; break;
   case lltok::kw_fastcc:         CC = CallingConv::Fast; break;
   case lltok::kw_coldcc:         CC = CallingConv::Cold; break;
+  case lltok::kw_cfguard_checkcc: CC = CallingConv::CFGuard_Check; break;
   case lltok::kw_x86_stdcallcc:  CC = CallingConv::X86_StdCall; break;
   case lltok::kw_x86_fastcallcc: CC = CallingConv::X86_FastCall; break;
   case lltok::kw_x86_regcallcc:  CC = CallingConv::X86_RegCall; break;
@@ -1972,6 +1978,9 @@ bool LLParser::ParseOptionalCallingConv(unsigned &CC) {
   case lltok::kw_arm_aapcscc:    CC = CallingConv::ARM_AAPCS; break;
   case lltok::kw_arm_aapcs_vfpcc:CC = CallingConv::ARM_AAPCS_VFP; break;
   case lltok::kw_aarch64_vector_pcs:CC = CallingConv::AArch64_VectorCall; break;
+  case lltok::kw_aarch64_sve_vector_pcs:
+    CC = CallingConv::AArch64_SVE_VectorCall;
+    break;
   case lltok::kw_msp430_intrcc:  CC = CallingConv::MSP430_INTR; break;
   case lltok::kw_avr_intrcc:     CC = CallingConv::AVR_INTR; break;
   case lltok::kw_avr_signalcc:   CC = CallingConv::AVR_SIGNAL; break;
@@ -2000,6 +2009,7 @@ bool LLParser::ParseOptionalCallingConv(unsigned &CC) {
   case lltok::kw_amdgpu_ps:      CC = CallingConv::AMDGPU_PS; break;
   case lltok::kw_amdgpu_cs:      CC = CallingConv::AMDGPU_CS; break;
   case lltok::kw_amdgpu_kernel:  CC = CallingConv::AMDGPU_KERNEL; break;
+  case lltok::kw_tailcc:         CC = CallingConv::Tail; break;
   case lltok::kw_cc: {
       Lex.Lex();
       return ParseUInt32(CC);
@@ -2067,16 +2077,19 @@ bool LLParser::ParseOptionalFunctionMetadata(Function &F) {
 /// ParseOptionalAlignment
 ///   ::= /* empty */
 ///   ::= 'align' 4
-bool LLParser::ParseOptionalAlignment(unsigned &Alignment) {
-  Alignment = 0;
+bool LLParser::ParseOptionalAlignment(MaybeAlign &Alignment) {
+  Alignment = None;
   if (!EatIfPresent(lltok::kw_align))
     return false;
   LocTy AlignLoc = Lex.getLoc();
-  if (ParseUInt32(Alignment)) return true;
-  if (!isPowerOf2_32(Alignment))
+  uint32_t Value = 0;
+  if (ParseUInt32(Value))
+    return true;
+  if (!isPowerOf2_32(Value))
     return Error(AlignLoc, "alignment is not a power of two");
-  if (Alignment > Value::MaximumAlignment)
+  if (Value > Value::MaximumAlignment)
     return Error(AlignLoc, "huge alignments are not supported yet");
+  Alignment = Align(Value);
   return false;
 }
 
@@ -2113,7 +2126,7 @@ bool LLParser::ParseOptionalDerefAttrBytes(lltok::Kind AttrKind,
 ///
 /// This returns with AteExtraComma set to true if it ate an excess comma at the
 /// end.
-bool LLParser::ParseOptionalCommaAlign(unsigned &Alignment,
+bool LLParser::ParseOptionalCommaAlign(MaybeAlign &Alignment,
                                        bool &AteExtraComma) {
   AteExtraComma = false;
   while (EatIfPresent(lltok::comma)) {
@@ -2551,6 +2564,7 @@ bool LLParser::ParseOptionalOperandBundles(
 ///
 bool LLParser::ParseArgumentList(SmallVectorImpl<ArgInfo> &ArgList,
                                  bool &isVarArg){
+  unsigned CurValID = 0;
   isVarArg = false;
   assert(Lex.getKind() == lltok::lparen);
   Lex.Lex(); // eat the (.
@@ -2575,6 +2589,12 @@ bool LLParser::ParseArgumentList(SmallVectorImpl<ArgInfo> &ArgList,
     if (Lex.getKind() == lltok::LocalVar) {
       Name = Lex.getStrVal();
       Lex.Lex();
+    } else if (Lex.getKind() == lltok::LocalVarID) {
+      if (Lex.getUIntVal() != CurValID)
+        return Error(TypeLoc, "argument expected to be numbered '%" +
+                                  Twine(CurValID) + "'");
+      ++CurValID;
+      Lex.Lex();
     }
 
     if (!FunctionType::isValidArgumentType(ArgTy))
@@ -2602,6 +2622,13 @@ bool LLParser::ParseArgumentList(SmallVectorImpl<ArgInfo> &ArgList,
         Name = Lex.getStrVal();
         Lex.Lex();
       } else {
+        if (Lex.getKind() == lltok::LocalVarID) {
+          if (Lex.getUIntVal() != CurValID)
+            return Error(TypeLoc, "argument expected to be numbered '%" +
+                                      Twine(CurValID) + "'");
+          Lex.Lex();
+        }
+        ++CurValID;
         Name = "";
       }
 
@@ -3093,7 +3120,7 @@ bool LLParser::ParseValID(ValID &ID, PerFunctionState *PFS) {
         ParseToken(lltok::rbrace, "expected end of struct constant"))
       return true;
 
-    ID.ConstantStructElts = make_unique<Constant *[]>(Elts.size());
+    ID.ConstantStructElts = std::make_unique<Constant *[]>(Elts.size());
     ID.UIntVal = Elts.size();
     memcpy(ID.ConstantStructElts.get(), Elts.data(),
            Elts.size() * sizeof(Elts[0]));
@@ -3115,7 +3142,7 @@ bool LLParser::ParseValID(ValID &ID, PerFunctionState *PFS) {
       return true;
 
     if (isPackedStruct) {
-      ID.ConstantStructElts = make_unique<Constant *[]>(Elts.size());
+      ID.ConstantStructElts = std::make_unique<Constant *[]>(Elts.size());
       memcpy(ID.ConstantStructElts.get(), Elts.data(),
              Elts.size() * sizeof(Elts[0]));
       ID.UIntVal = Elts.size();
@@ -4794,19 +4821,19 @@ bool LLParser::ParseDIMacroFile(MDNode *&Result, bool IsDistinct) {
 
 /// ParseDIModule:
 ///   ::= !DIModule(scope: !0, name: "SomeModule", configMacros: "-DNDEBUG",
-///                 includePath: "/usr/include", isysroot: "/")
+///                 includePath: "/usr/include", sysroot: "/")
 bool LLParser::ParseDIModule(MDNode *&Result, bool IsDistinct) {
 #define VISIT_MD_FIELDS(OPTIONAL, REQUIRED)                                    \
   REQUIRED(scope, MDField, );                                                  \
   REQUIRED(name, MDStringField, );                                             \
   OPTIONAL(configMacros, MDStringField, );                                     \
   OPTIONAL(includePath, MDStringField, );                                      \
-  OPTIONAL(isysroot, MDStringField, );
+  OPTIONAL(sysroot, MDStringField, );
   PARSE_MD_FIELDS();
 #undef VISIT_MD_FIELDS
 
   Result = GET_OR_DISTINCT(DIModule, (Context, scope.Val, name.Val,
-                           configMacros.Val, includePath.Val, isysroot.Val));
+                           configMacros.Val, includePath.Val, sysroot.Val));
   return false;
 }
 
@@ -5354,7 +5381,7 @@ bool LLParser::ParseFunctionHeader(Function *&Fn, bool isDefine) {
   LocTy BuiltinLoc;
   std::string Section;
   std::string Partition;
-  unsigned Alignment;
+  MaybeAlign Alignment;
   std::string GC;
   GlobalValue::UnnamedAddr UnnamedAddr = GlobalValue::UnnamedAddr::None;
   unsigned AddrSpace = 0;
@@ -5471,7 +5498,7 @@ bool LLParser::ParseFunctionHeader(Function *&Fn, bool isDefine) {
   Fn->setCallingConv(CC);
   Fn->setAttributes(PAL);
   Fn->setUnnamedAddr(UnnamedAddr);
-  Fn->setAlignment(Alignment);
+  Fn->setAlignment(MaybeAlign(Alignment));
   Fn->setSection(Section);
   Fn->setPartition(Partition);
   Fn->setComdat(C);
@@ -5777,7 +5804,7 @@ int LLParser::ParseInstruction(Instruction *&Inst, BasicBlock *BB,
     if (Res != 0)
       return Res;
     if (FMF.any()) {
-      if (!Inst->getType()->isFPOrFPVectorTy())
+      if (!isa<FPMathOperator>(Inst))
         return Error(Loc, "fast-math-flags specified for select without "
                           "floating-point scalar or vector return type");
       Inst->setFastMathFlags(FMF);
@@ -5788,8 +5815,21 @@ int LLParser::ParseInstruction(Instruction *&Inst, BasicBlock *BB,
   case lltok::kw_extractelement: return ParseExtractElement(Inst, PFS);
   case lltok::kw_insertelement:  return ParseInsertElement(Inst, PFS);
   case lltok::kw_shufflevector:  return ParseShuffleVector(Inst, PFS);
-  case lltok::kw_phi:            return ParsePHI(Inst, PFS);
+  case lltok::kw_phi: {
+    FastMathFlags FMF = EatFastMathFlagsIfPresent();
+    int Res = ParsePHI(Inst, PFS);
+    if (Res != 0)
+      return Res;
+    if (FMF.any()) {
+      if (!isa<FPMathOperator>(Inst))
+        return Error(Loc, "fast-math-flags specified for phi without "
+                          "floating-point scalar or vector return type");
+      Inst->setFastMathFlags(FMF);
+    }
+    return 0;
+  }
   case lltok::kw_landingpad:     return ParseLandingPad(Inst, PFS);
+  case lltok::kw_freeze:         return ParseFreeze(Inst, PFS);
   // Call.
   case lltok::kw_call:     return ParseCall(Inst, PFS, CallInst::TCK_None);
   case lltok::kw_tail:     return ParseCall(Inst, PFS, CallInst::TCK_Tail);
@@ -6713,6 +6753,18 @@ bool LLParser::ParseLandingPad(Instruction *&Inst, PerFunctionState &PFS) {
   return false;
 }
 
+/// ParseFreeze
+///   ::= 'freeze' Type Value
+bool LLParser::ParseFreeze(Instruction *&Inst, PerFunctionState &PFS) {
+  LocTy Loc;
+  Value *Op;
+  if (ParseTypeAndValue(Op, Loc, PFS))
+    return true;
+
+  Inst = new FreezeInst(Op);
+  return false;
+}
+
 /// ParseCall
 ///   ::= 'call' OptionalFastMathFlags OptionalCallingConv
 ///           OptionalAttrs Type Value ParameterList OptionalAttrs
@@ -6753,10 +6805,6 @@ bool LLParser::ParseCall(Instruction *&Inst, PerFunctionState &PFS,
       ParseOptionalOperandBundles(BundleList, PFS))
     return true;
 
-  if (FMF.any() && !RetType->isFPOrFPVectorTy())
-    return Error(CallLoc, "fast-math-flags specified for call without "
-                          "floating-point scalar or vector return type");
-
   // If RetType is a non-function pointer type, then this is the short syntax
   // for the call, which means that RetType is just the return type.  Infer the
   // rest of the function argument types from the arguments that are present.
@@ -6819,8 +6867,12 @@ bool LLParser::ParseCall(Instruction *&Inst, PerFunctionState &PFS,
   CallInst *CI = CallInst::Create(Ty, Callee, Args, BundleList);
   CI->setTailCallKind(TCK);
   CI->setCallingConv(CC);
-  if (FMF.any())
+  if (FMF.any()) {
+    if (!isa<FPMathOperator>(CI))
+      return Error(CallLoc, "fast-math-flags specified for call without "
+                   "floating-point scalar or vector return type");
     CI->setFastMathFlags(FMF);
+  }
   CI->setAttributes(PAL);
   ForwardRefAttrGroups[CI] = FwdRefAttrGrps;
   Inst = CI;
@@ -6837,7 +6889,7 @@ bool LLParser::ParseCall(Instruction *&Inst, PerFunctionState &PFS,
 int LLParser::ParseAlloc(Instruction *&Inst, PerFunctionState &PFS) {
   Value *Size = nullptr;
   LocTy SizeLoc, TyLoc, ASLoc;
-  unsigned Alignment = 0;
+  MaybeAlign Alignment;
   unsigned AddrSpace = 0;
   Type *Ty = nullptr;
 
@@ -6898,7 +6950,7 @@ int LLParser::ParseAlloc(Instruction *&Inst, PerFunctionState &PFS) {
 ///       'singlethread'? AtomicOrdering (',' 'align' i32)?
 int LLParser::ParseLoad(Instruction *&Inst, PerFunctionState &PFS) {
   Value *Val; LocTy Loc;
-  unsigned Alignment = 0;
+  MaybeAlign Alignment;
   bool AteExtraComma = false;
   bool isAtomic = false;
   AtomicOrdering Ordering = AtomicOrdering::NotAtomic;
@@ -6947,7 +6999,7 @@ int LLParser::ParseLoad(Instruction *&Inst, PerFunctionState &PFS) {
 ///       'singlethread'? AtomicOrdering (',' 'align' i32)?
 int LLParser::ParseStore(Instruction *&Inst, PerFunctionState &PFS) {
   Value *Val, *Ptr; LocTy Loc, PtrLoc;
-  unsigned Alignment = 0;
+  MaybeAlign Alignment;
   bool AteExtraComma = false;
   bool isAtomic = false;
   AtomicOrdering Ordering = AtomicOrdering::NotAtomic;
@@ -8074,7 +8126,7 @@ bool LLParser::ParseFunctionSummary(std::string Name, GlobalValue::GUID GUID,
   if (ParseToken(lltok::rparen, "expected ')' here"))
     return true;
 
-  auto FS = llvm::make_unique<FunctionSummary>(
+  auto FS = std::make_unique<FunctionSummary>(
       GVFlags, InstCount, FFlags, /*EntryCount=*/0, std::move(Refs),
       std::move(Calls), std::move(TypeIdInfo.TypeTests),
       std::move(TypeIdInfo.TypeTestAssumeVCalls),
@@ -8134,7 +8186,7 @@ bool LLParser::ParseVariableSummary(std::string Name, GlobalValue::GUID GUID,
     return true;
 
   auto GS =
-      llvm::make_unique<GlobalVarSummary>(GVFlags, GVarFlags, std::move(Refs));
+      std::make_unique<GlobalVarSummary>(GVFlags, GVarFlags, std::move(Refs));
 
   GS->setModulePath(ModulePath);
   GS->setVTableFuncs(std::move(VTableFuncs));
@@ -8175,7 +8227,7 @@ bool LLParser::ParseAliasSummary(std::string Name, GlobalValue::GUID GUID,
   if (ParseToken(lltok::rparen, "expected ')' here"))
     return true;
 
-  auto AS = llvm::make_unique<AliasSummary>(GVFlags);
+  auto AS = std::make_unique<AliasSummary>(GVFlags);
 
   AS->setModulePath(ModulePath);
 
@@ -8211,6 +8263,8 @@ bool LLParser::ParseFlag(unsigned &Val) {
 ///        [',' 'readOnly' ':' Flag]? [',' 'noRecurse' ':' Flag]?
 ///        [',' 'returnDoesNotAlias' ':' Flag]? ')'
 ///        [',' 'noInline' ':' Flag]? ')'
+///        [',' 'alwaysInline' ':' Flag]? ')'
+
 bool LLParser::ParseOptionalFFlags(FunctionSummary::FFlags &FFlags) {
   assert(Lex.getKind() == lltok::kw_funcFlags);
   Lex.Lex();
@@ -8252,6 +8306,12 @@ bool LLParser::ParseOptionalFFlags(FunctionSummary::FFlags &FFlags) {
         return true;
       FFlags.NoInline = Val;
       break;
+    case lltok::kw_alwaysInline:
+      Lex.Lex();
+      if (ParseToken(lltok::colon, "expected ':'") || ParseFlag(Val))
+        return true;
+      FFlags.AlwaysInline = Val;
+      break;
     default:
       return Error(Lex.getLoc(), "expected function flag type");
     }
diff --git a/llvm-project-llvmorg-9.0.1/llvm/lib/AsmParser/LLParser.h b/llvm-project-llvmorg-10.0.0/llvm/lib/AsmParser/LLParser.h
index 610e2e2..cf2121d 100644
--- a/llvm-project-llvmorg-9.0.1/llvm/lib/AsmParser/LLParser.h
+++ b/llvm-project-llvmorg-10.0.0/llvm/lib/AsmParser/LLParser.h
@@ -281,14 +281,14 @@ namespace llvm {
     void ParseOptionalVisibility(unsigned &Res);
     void ParseOptionalDLLStorageClass(unsigned &Res);
     bool ParseOptionalCallingConv(unsigned &CC);
-    bool ParseOptionalAlignment(unsigned &Alignment);
+    bool ParseOptionalAlignment(MaybeAlign &Alignment);
     bool ParseOptionalDerefAttrBytes(lltok::Kind AttrKind, uint64_t &Bytes);
     bool ParseScopeAndOrdering(bool isAtomic, SyncScope::ID &SSID,
                                AtomicOrdering &Ordering);
     bool ParseScope(SyncScope::ID &SSID);
     bool ParseOrdering(AtomicOrdering &Ordering);
     bool ParseOptionalStackAlignment(unsigned &Alignment);
-    bool ParseOptionalCommaAlign(unsigned &Alignment, bool &AteExtraComma);
+    bool ParseOptionalCommaAlign(MaybeAlign &Alignment, bool &AteExtraComma);
     bool ParseOptionalCommaAddrSpace(unsigned &AddrSpace, LocTy &Loc,
                                      bool &AteExtraComma);
     bool ParseOptionalCommaInAlloca(bool &IsInAlloca);
@@ -600,6 +600,7 @@ namespace llvm {
     int ParseGetElementPtr(Instruction *&Inst, PerFunctionState &PFS);
     int ParseExtractValue(Instruction *&Inst, PerFunctionState &PFS);
     int ParseInsertValue(Instruction *&Inst, PerFunctionState &PFS);
+    bool ParseFreeze(Instruction *&I, PerFunctionState &PFS);
 
     // Use-list order directives.
     bool ParseUseListOrder(PerFunctionState *PFS = nullptr);
diff --git a/llvm-project-llvmorg-9.0.1/llvm/lib/AsmParser/LLToken.h b/llvm-project-llvmorg-10.0.0/llvm/lib/AsmParser/LLToken.h
index 0e9ba4d..e430e0f 100644
--- a/llvm-project-llvmorg-9.0.1/llvm/lib/AsmParser/LLToken.h
+++ b/llvm-project-llvmorg-10.0.0/llvm/lib/AsmParser/LLToken.h
@@ -132,6 +132,7 @@ enum Kind {
   kw_fastcc,
   kw_coldcc,
   kw_intel_ocl_bicc,
+  kw_cfguard_checkcc,
   kw_x86_stdcallcc,
   kw_x86_fastcallcc,
   kw_x86_thiscallcc,
@@ -141,6 +142,7 @@ enum Kind {
   kw_arm_aapcscc,
   kw_arm_aapcs_vfpcc,
   kw_aarch64_vector_pcs,
+  kw_aarch64_sve_vector_pcs,
   kw_msp430_intrcc,
   kw_avr_intrcc,
   kw_avr_signalcc,
@@ -168,6 +170,7 @@ enum Kind {
   kw_amdgpu_ps,
   kw_amdgpu_cs,
   kw_amdgpu_kernel,
+  kw_tailcc,
 
   // Attributes:
   kw_attributes,
@@ -351,6 +354,8 @@ enum Kind {
   kw_insertvalue,
   kw_blockaddress,
 
+  kw_freeze,
+
   // Metadata types.
   kw_distinct,
 
@@ -379,6 +384,7 @@ enum Kind {
   kw_noRecurse,
   kw_returnDoesNotAlias,
   kw_noInline,
+  kw_alwaysInline,
   kw_calls,
   kw_callee,
   kw_hotness,
diff --git a/llvm-project-llvmorg-9.0.1/llvm/lib/AsmParser/Parser.cpp b/llvm-project-llvmorg-10.0.0/llvm/lib/AsmParser/Parser.cpp
index b13c623..b7f552a 100644
--- a/llvm-project-llvmorg-9.0.1/llvm/lib/AsmParser/Parser.cpp
+++ b/llvm-project-llvmorg-10.0.0/llvm/lib/AsmParser/Parser.cpp
@@ -42,7 +42,7 @@ llvm::parseAssembly(MemoryBufferRef F, SMDiagnostic &Err, LLVMContext &Context,
                     SlotMapping *Slots, bool UpgradeDebugInfo,
                     StringRef DataLayoutString) {
   std::unique_ptr<Module> M =
-      make_unique<Module>(F.getBufferIdentifier(), Context);
+      std::make_unique<Module>(F.getBufferIdentifier(), Context);
 
   if (parseAssemblyInto(F, M.get(), nullptr, Err, Slots, UpgradeDebugInfo,
                         DataLayoutString))
@@ -71,9 +71,9 @@ ParsedModuleAndIndex llvm::parseAssemblyWithIndex(
     MemoryBufferRef F, SMDiagnostic &Err, LLVMContext &Context,
     SlotMapping *Slots, bool UpgradeDebugInfo, StringRef DataLayoutString) {
   std::unique_ptr<Module> M =
-      make_unique<Module>(F.getBufferIdentifier(), Context);
+      std::make_unique<Module>(F.getBufferIdentifier(), Context);
   std::unique_ptr<ModuleSummaryIndex> Index =
-      make_unique<ModuleSummaryIndex>(/*HaveGVs=*/true);
+      std::make_unique<ModuleSummaryIndex>(/*HaveGVs=*/true);
 
   if (parseAssemblyInto(F, M.get(), Index.get(), Err, Slots, UpgradeDebugInfo,
                         DataLayoutString))
@@ -123,7 +123,7 @@ static bool parseSummaryIndexAssemblyInto(MemoryBufferRef F,
 std::unique_ptr<ModuleSummaryIndex>
 llvm::parseSummaryIndexAssembly(MemoryBufferRef F, SMDiagnostic &Err) {
   std::unique_ptr<ModuleSummaryIndex> Index =
-      make_unique<ModuleSummaryIndex>(/*HaveGVs=*/false);
+      std::make_unique<ModuleSummaryIndex>(/*HaveGVs=*/false);
 
   if (parseSummaryIndexAssemblyInto(F, *Index, Err))
     return nullptr;

@dannypsnl

This comment has been minimized.

dannypsnl added a commit to llir/ll that referenced this issue Apr 7, 2020
mewmew pushed a commit that referenced this issue Apr 7, 2020
* (#132) instruction: phi with FastMathFlags

* (#132) remove FPrintf to reduce warning

* (#132) use existed function

* (#132) consistency style
mewmew added a commit to llir/grammar that referenced this issue Apr 7, 2020
mewmew added a commit to llir/grammar that referenced this issue Apr 10, 2020
dannypsnl added a commit to llir/ll that referenced this issue Apr 10, 2020
mewmew added a commit to llir/ll that referenced this issue Apr 10, 2020
mewmew pushed a commit that referenced this issue Apr 10, 2020
* (#132) DIModule: sysroot, related code change

* (#132) upgrade llir/ll for DIModule syntax update
@mewmew
Copy link
Member Author

mewmew commented Apr 14, 2020

With #128, llir/ll#2 and llir/testdata#4 applied, almost all test cases are passing!

The only one failing (except for fma.ll, see #133), is compatability.ll, for which we get the following error:

unable to locate local identifier "%op1" of "@instructions.other"

    asm_test.go:47: unable to parse "../../testdata/llvm/test/Bitcode/compatibility.ll" into AST; unable to locate local identifier "%op1" of "@instructions.other"

This is the code for @instruction.other:

; Instructions -- Other Operations
define void @instructions.other(i32 %op1, i32 %op2, half %fop1, half %fop2, <2 x i32> %vop, i8* %pop) {
entry:
  icmp eq  i32 %op1, %op2
...

Minimal reproducing test case, this one works for add but fails for freeze:

define void @f(i32 %x) {
entry:
	add i32 %x, 42 ; works
	freeze i32 %x  ; fails
	ret void
}

Edit2: I found the issue. In asm/inst_other.go, when invoking newFreezeInst, we invoke fgen.irTypeValue(old.X()), but should only invoke fgen.gen.irType(old.X().Typ()). The reason for this is that we only extract the type at this stage, since the underlying value may not yet be known for local variables.

This is what we reference in the comment with "without body but with type".

// newFreezeInst returns a new IR freeze instruction (without body but with
// type) based on the given AST freeze instruction.

Edit:

And as noted before, the Coreutils and SQLite test cases have not yet been updated. They will be as soon as Clang 10.0 is released for Arch Linux. (It is currently in staging: https://www.archlinux.org/packages/staging/x86_64/clang/). So for now, you can safely disable (comment out) the Coreutils and SQLite test cases in asm_test.go; e.g.

$ git diff asm ir
diff --git a/asm/asm_test.go b/asm/asm_test.go
index 1e3d87e..5c4c8f9 100644
--- a/asm/asm_test.go
+++ b/asm/asm_test.go
@@ -80,7 +80,7 @@ func TestParseFile(t *testing.T) {
                {path: "../testdata/llvm/test/DebugInfo/ARM/selectiondag-deadcode.ll"},
 
                // fsub constant expressions.
-               {path: "../testdata/llvm/test/Transforms/InstCombine/fma.ll"},
+               //{path: "../testdata/llvm/test/Transforms/InstCombine/fma.ll"},
 
                // Constant expressions.
                {path: "../testdata/llvm/test/Transforms/ConstProp/constant-expr.ll"},
@@ -388,6 +388,7 @@ func TestParseFile(t *testing.T) {
                {path: "../testdata/llvm/test/DebugInfo/X86/stack-value-dwarf2.ll"},
 
                // Coreutils.
+               /*
                {path: "../testdata/coreutils/test/[.ll"},
                {path: "../testdata/coreutils/test/b2sum.ll"},
                {path: "../testdata/coreutils/test/base32.ll"},
@@ -498,6 +499,7 @@ func TestParseFile(t *testing.T) {
 
                // SQLite.
                {path: "../testdata/sqlite/test/shell.ll"},
+               */
        }
        hasTestdata := osutil.Exists("../testdata/llvm")
        for _, g := range golden {
diff --git a/ir/asm_test.go b/ir/asm_test.go
index 2cdb965..58e46d3 100644
--- a/ir/asm_test.go
+++ b/ir/asm_test.go
@@ -21,7 +21,7 @@ func TestModule(t *testing.T) {
                // LLVM IR compatibility.
                {path: "../testdata/llvm/test/Bitcode/compatibility.ll"},
                // Coreutils.
-               {path: "../testdata/coreutils/test/cat.ll"},
+               //{path: "../testdata/coreutils/test/cat.ll"},
        }
        hasTestdata := osutil.Exists("../testdata/llvm")
        for _, g := range golden {
diff --git a/ir/constant/asm_test.go b/ir/constant/asm_test.go
index 9c366f7..0598fa2 100644
--- a/ir/constant/asm_test.go
+++ b/ir/constant/asm_test.go
@@ -27,12 +27,12 @@ func TestModule(t *testing.T) {
                {path: "../../testdata/llvm/test/Transforms/ConstProp/constant-expr.ll"},
                {path: "../../testdata/llvm/test/Assembler/insertextractvalue.ll"},
                {path: "../../testdata/llvm/test/DebugInfo/ARM/selectiondag-deadcode.ll"},
-               {path: "../../testdata/llvm/test/Transforms/InstCombine/fma.ll"},
+               //{path: "../../testdata/llvm/test/Transforms/InstCombine/fma.ll"},
                {path: "../../testdata/llvm/test/Transforms/InstCombine/vec_demanded_elts.ll"},
                {path: "../../testdata/llvm/test/Transforms/InstCombine/vector_insertelt_shuffle.ll"},
                // Coreutils.
-               {path: "../../testdata/coreutils/test/timeout.ll"},
-               {path: "../../testdata/coreutils/test/vdir.ll"},
+               //{path: "../../testdata/coreutils/test/timeout.ll"},
+               //{path: "../../testdata/coreutils/test/vdir.ll"},
        }
        hasTestdata := osutil.Exists("../../testdata/llvm")
        for _, g := range golden {
diff --git a/ir/metadata/asm_test.go b/ir/metadata/asm_test.go
index b7e6eb7..bb1e8db 100644
--- a/ir/metadata/asm_test.go
+++ b/ir/metadata/asm_test.go
@@ -21,7 +21,7 @@ func TestModule(t *testing.T) {
                // Specialized metadata nodes.
                {path: "../../testdata/llvm/test/Assembler/debug-info.ll"},
                // Coreutils.
-               {path: "../../testdata/coreutils/test/cat.ll"},
+               //{path: "../../testdata/coreutils/test/cat.ll"},
        }
        hasTestdata := osutil.Exists("../../testdata/llvm")
        for _, g := range golden {

mewmew added a commit to llir/testdata that referenced this issue Apr 15, 2020
mewmew added a commit to llir/testdata that referenced this issue Apr 15, 2020
This checks nofree when used as parameter attribute.

Updates llir/llvm#132.
mewmew added a commit that referenced this issue Apr 15, 2020
This includes test cases for the use of nofree as parameter attribute
and the new calling conventions of LLVM 10.0.

Updates #132.

An additional change, is to name unnamed basic blocks (if not the
entry basic block). This change was introduced in LLVM 9.0 I think.

Essentially, for any block with a local ID that is not the entry block,
we use an explicit label (e.g. `2:`) instead of just adding a comment
(e.g. `; <label>:2`. This will require an update to the llir/llvm/ir
basic block output function.
mewmew added a commit to llir/testdata that referenced this issue Apr 15, 2020
This is to conform with the output of LLVM 9.0 and above.

Updates llir/llvm#132.

This change was automatically applied using sar [1]:

	find . -type f -name '*.ll.golden' | xargs -I '{}' sar -i '[\n]; <label>:([0-9]+)' '
                                        ${1}:' '{}'

[1]: https://godoc.org/github.com/mewkiz/cmd/sar
mewmew added a commit to mewpull/testdata that referenced this issue Apr 22, 2020
…rsion

To update the SQLite test case to the latest version using Clang 10.0, these steps were taken.

	1. Update VER in Makefile to 3310100 and update the download link to include /2020/.
	2. Run make from the sqlite directory.
	3. Run `l-ir -p sqlite.ll > sqlite.ll.golden`, and use `diff -u -w` to verify that the difference is only cosmetic (e.g. comments).
	4. Commit changes to Makefile and sqlite/test/*.ll and sqlite/test/*.ll.golden

The contents of l-ir is presented at https://play.golang.org/p/a7FLFnEbePL

Updates llir/llvm#139 and updates llir/llvm#132.
mewmew added a commit to mewpull/testdata that referenced this issue Apr 22, 2020
… version

To update the Coreutils test case to the latest version using Clang 10.0, these steps were taken.

	1. Update VER in Makefile to 8.32.
	2. Run make from the coreutils directory.
	3. For each *.ll file in coreutils/test/, run `l-ir -p foo.ll > foo.ll.golden`, and use `diff -u -w` to verify that the difference is only cosmetic (e.g. comments).
		find coreutils/test/ -type f -name '*.ll' | xargs -I '{}' l-ir -p -o "{}.golden" "{}"
	4. Commit changes to Makefile and coreutils/test/*.ll and coreutils/test/*.ll.golden

The contents of l-ir is presented at https://play.golang.org/p/a7FLFnEbePL

Updates llir/llvm#139 and updates llir/llvm#132.
mewmew added a commit to llir/testdata that referenced this issue Apr 22, 2020
… and update to latest versions (#6)

* sqlite: regenerate test case using Clang 10.0 and update to latest version

To update the SQLite test case to the latest version using Clang 10.0, these steps were taken.

	1. Update VER in Makefile to 3310100 and update the download link to include /2020/.
	2. Run make from the sqlite directory.
	3. Run `l-ir -p sqlite.ll > sqlite.ll.golden`, and use `diff -u -w` to verify that the difference is only cosmetic (e.g. comments).
	4. Commit changes to Makefile and sqlite/test/*.ll and sqlite/test/*.ll.golden

The contents of l-ir is presented at https://play.golang.org/p/a7FLFnEbePL

Updates llir/llvm#139 and updates llir/llvm#132.

* coreutils: regenerate test case using Clang 10.0 and update to latest version

To update the Coreutils test case to the latest version using Clang 10.0, these steps were taken.

	1. Update VER in Makefile to 8.32.
	2. Run make from the coreutils directory.
	3. For each *.ll file in coreutils/test/, run `l-ir -p foo.ll > foo.ll.golden`, and use `diff -u -w` to verify that the difference is only cosmetic (e.g. comments).
		find coreutils/test/ -type f -name '*.ll' | xargs -I '{}' l-ir -p -o "{}.golden" "{}"
	4. Commit changes to Makefile and coreutils/test/*.ll and coreutils/test/*.ll.golden

The contents of l-ir is presented at https://play.golang.org/p/a7FLFnEbePL

Updates llir/llvm#139 and updates llir/llvm#132.
@mewmew
Copy link
Member Author

mewmew commented Apr 22, 2020

The test cases of Coreutils and SQLite have now been regenerated using Clang 10.0. To keep how to information in one place, I'll include the commit message of PR llir/testdata#6 here.

To update the SQLite test case to the latest version using Clang 10.0, these steps were taken.

1. Update VER in Makefile to 3310100 and update the download link to include /2020/.
2. Run make from the sqlite directory.
3. Run `l-ir -p sqlite.ll > sqlite.ll.golden`, and use `diff -u -w` to verify that the difference is only cosmetic (e.g. comments).
4. Commit changes to Makefile and sqlite/test/*.ll and sqlite/test/*.ll.golden

To update the Coreutils test case to the latest version using Clang 10.0, these steps were taken.

1. Update VER in Makefile to 8.32.
2. Run make from the coreutils directory.
3. For each *.ll file in coreutils/test/, run `l-ir -p foo.ll > foo.ll.golden`, and use `diff -u -w` to verify that the difference is only cosmetic (e.g. comments).
	find coreutils/test/ -type f -name '*.ll' | xargs -I '{}' l-ir -p -o "{}.golden" "{}"
4. Commit changes to Makefile and coreutils/test/*.ll and coreutils/test/*.ll.golden

The contents of the l-ir tool is presented at https://play.golang.org/p/3QzA2Y0W_c8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants