diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/basic-metadata.ll b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/basic-metadata.ll new file mode 100644 --- /dev/null +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/basic-metadata.ll @@ -0,0 +1,10 @@ +; Just run it through opt, no passes needed. +; RUN: opt < %s -S | FileCheck %s + +define double @fpmathTest(double %a, double %b) { +entry: + %ret = fmul double %a, %b, !fpmath !0 + ret double %ret +} + +!0 = !{float 3.0} diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/basic-metadata.ll.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/basic-metadata.ll.expected new file mode 100644 --- /dev/null +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/basic-metadata.ll.expected @@ -0,0 +1,16 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; Just run it through opt, no passes needed. +; RUN: opt < %s -S | FileCheck %s + +define double @fpmathTest(double %a, double %b) { +; CHECK-LABEL: @fpmathTest( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[RET:%.*]] = fmul double [[A:%.*]], [[B:%.*]], !fpmath [[FPMATH0:![0-9]+]] +; CHECK-NEXT: ret double [[RET]] +; +entry: + %ret = fmul double %a, %b, !fpmath !0 + ret double %ret +} + +!0 = !{float 3.0} diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/basic-metadata.ll.globals.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/basic-metadata.ll.globals.expected new file mode 100644 --- /dev/null +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/basic-metadata.ll.globals.expected @@ -0,0 +1,19 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals +; Just run it through opt, no passes needed. +; RUN: opt < %s -S | FileCheck %s + +define double @fpmathTest(double %a, double %b) { +; CHECK-LABEL: @fpmathTest( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[RET:%.*]] = fmul double [[A:%.*]], [[B:%.*]], !fpmath [[FPMATH0:![0-9]+]] +; CHECK-NEXT: ret double [[RET]] +; +entry: + %ret = fmul double %a, %b, !fpmath !0 + ret double %ret +} + +!0 = !{float 3.0} +;. +; CHECK: [[FPMATH0]] = !{float 3.000000e+00} +;. diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/basic-metadata.test b/llvm/test/tools/UpdateTestChecks/update_test_checks/basic-metadata.test new file mode 100644 --- /dev/null +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/basic-metadata.test @@ -0,0 +1,9 @@ +## Basic test checking that update_test_checks.py differnt metadata +# RUN: cp -f %S/Inputs/basic-metadata.ll %t.ll && %update_test_checks %t.ll +# RUN: diff -u %t.ll %S/Inputs/basic-metadata.ll.expected +## Check that running the script again does not change the result: +# RUN: %update_test_checks %t.ll +# RUN: diff -u %t.ll %S/Inputs/basic-metadata.ll.expected +## Also try the --check-globals flag +# RUN: %update_test_checks %t.ll --check-globals +# RUN: diff -u %t.ll %S/Inputs/basic-metadata.ll.globals.expected diff --git a/llvm/utils/UpdateTestChecks/common.py b/llvm/utils/UpdateTestChecks/common.py --- a/llvm/utils/UpdateTestChecks/common.py +++ b/llvm/utils/UpdateTestChecks/common.py @@ -976,6 +976,7 @@ ), NamelessValue(r"DBG", "!", r"!dbg ", r"![0-9]+", None), NamelessValue(r"DIASSIGNID", "!", r"!DIAssignID ", r"![0-9]+", None), + NamelessValue(r"FPMATH", "!", r"!fpmath ", r"![0-9]+", None), NamelessValue(r"PROF", "!", r"!prof ", r"![0-9]+", None), NamelessValue(r"TBAA", "!", r"!tbaa ", r"![0-9]+", None), NamelessValue(r"TBAA_STRUCT", "!", r"!tbaa.struct ", r"![0-9]+", None),