From dd0b3c2fa62786d9e1fd8d70cdcfe778c74c0a7d Mon Sep 17 00:00:00 2001 From: Ben Shi <2283975856@qq.com> Date: Fri, 24 Nov 2023 16:23:56 +0800 Subject: [PATCH 01/35] [clang][analyzer] Support `fprintf` in the SecuritySyntaxChecker (#73247) --- .../Checkers/CheckSecuritySyntaxOnly.cpp | 76 ++++++++++--------- clang/test/Analysis/security-syntax-checks.c | 15 +++- 2 files changed, 51 insertions(+), 40 deletions(-) diff --git a/clang/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp b/clang/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp index 1a88615f01697c..dbba12bb4355c3 100644 --- a/clang/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp @@ -144,38 +144,39 @@ void WalkAST::VisitCallExpr(CallExpr *CE) { Name = Name.substr(10); // Set the evaluation function by switching on the callee name. - FnCheck evalFunction = llvm::StringSwitch(Name) - .Case("bcmp", &WalkAST::checkCall_bcmp) - .Case("bcopy", &WalkAST::checkCall_bcopy) - .Case("bzero", &WalkAST::checkCall_bzero) - .Case("gets", &WalkAST::checkCall_gets) - .Case("getpw", &WalkAST::checkCall_getpw) - .Case("mktemp", &WalkAST::checkCall_mktemp) - .Case("mkstemp", &WalkAST::checkCall_mkstemp) - .Case("mkdtemp", &WalkAST::checkCall_mkstemp) - .Case("mkstemps", &WalkAST::checkCall_mkstemp) - .Cases("strcpy", "__strcpy_chk", &WalkAST::checkCall_strcpy) - .Cases("strcat", "__strcat_chk", &WalkAST::checkCall_strcat) - .Cases("sprintf", "vsprintf", "scanf", "wscanf", "fscanf", "fwscanf", - "vscanf", "vwscanf", "vfscanf", "vfwscanf", - &WalkAST::checkDeprecatedOrUnsafeBufferHandling) - .Cases("sscanf", "swscanf", "vsscanf", "vswscanf", "swprintf", - "snprintf", "vswprintf", "vsnprintf", "memcpy", "memmove", - &WalkAST::checkDeprecatedOrUnsafeBufferHandling) - .Cases("strncpy", "strncat", "memset", - &WalkAST::checkDeprecatedOrUnsafeBufferHandling) - .Case("drand48", &WalkAST::checkCall_rand) - .Case("erand48", &WalkAST::checkCall_rand) - .Case("jrand48", &WalkAST::checkCall_rand) - .Case("lrand48", &WalkAST::checkCall_rand) - .Case("mrand48", &WalkAST::checkCall_rand) - .Case("nrand48", &WalkAST::checkCall_rand) - .Case("lcong48", &WalkAST::checkCall_rand) - .Case("rand", &WalkAST::checkCall_rand) - .Case("rand_r", &WalkAST::checkCall_rand) - .Case("random", &WalkAST::checkCall_random) - .Case("vfork", &WalkAST::checkCall_vfork) - .Default(nullptr); + FnCheck evalFunction = + llvm::StringSwitch(Name) + .Case("bcmp", &WalkAST::checkCall_bcmp) + .Case("bcopy", &WalkAST::checkCall_bcopy) + .Case("bzero", &WalkAST::checkCall_bzero) + .Case("gets", &WalkAST::checkCall_gets) + .Case("getpw", &WalkAST::checkCall_getpw) + .Case("mktemp", &WalkAST::checkCall_mktemp) + .Case("mkstemp", &WalkAST::checkCall_mkstemp) + .Case("mkdtemp", &WalkAST::checkCall_mkstemp) + .Case("mkstemps", &WalkAST::checkCall_mkstemp) + .Cases("strcpy", "__strcpy_chk", &WalkAST::checkCall_strcpy) + .Cases("strcat", "__strcat_chk", &WalkAST::checkCall_strcat) + .Cases("sprintf", "vsprintf", "scanf", "wscanf", "fscanf", "fwscanf", + "vscanf", "vwscanf", "vfscanf", "vfwscanf", + &WalkAST::checkDeprecatedOrUnsafeBufferHandling) + .Cases("sscanf", "swscanf", "vsscanf", "vswscanf", "swprintf", + "snprintf", "vswprintf", "vsnprintf", "memcpy", "memmove", + &WalkAST::checkDeprecatedOrUnsafeBufferHandling) + .Cases("strncpy", "strncat", "memset", "fprintf", + &WalkAST::checkDeprecatedOrUnsafeBufferHandling) + .Case("drand48", &WalkAST::checkCall_rand) + .Case("erand48", &WalkAST::checkCall_rand) + .Case("jrand48", &WalkAST::checkCall_rand) + .Case("lrand48", &WalkAST::checkCall_rand) + .Case("mrand48", &WalkAST::checkCall_rand) + .Case("nrand48", &WalkAST::checkCall_rand) + .Case("lcong48", &WalkAST::checkCall_rand) + .Case("rand", &WalkAST::checkCall_rand) + .Case("rand_r", &WalkAST::checkCall_rand) + .Case("random", &WalkAST::checkCall_random) + .Case("vfork", &WalkAST::checkCall_vfork) + .Default(nullptr); // If the callee isn't defined, it is not of security concern. // Check and evaluate the call. @@ -737,10 +738,10 @@ void WalkAST::checkCall_strcat(const CallExpr *CE, const FunctionDecl *FD) { // Check: Any use of 'sprintf', 'vsprintf', 'scanf', 'wscanf', 'fscanf', // 'fwscanf', 'vscanf', 'vwscanf', 'vfscanf', 'vfwscanf', 'sscanf', // 'swscanf', 'vsscanf', 'vswscanf', 'swprintf', 'snprintf', 'vswprintf', -// 'vsnprintf', 'memcpy', 'memmove', 'strncpy', 'strncat', 'memset' -// is deprecated since C11. +// 'vsnprintf', 'memcpy', 'memmove', 'strncpy', 'strncat', 'memset', +// 'fprintf' is deprecated since C11. // -// Use of 'sprintf', 'vsprintf', 'scanf', 'wscanf','fscanf', +// Use of 'sprintf', 'fprintf', 'vsprintf', 'scanf', 'wscanf', 'fscanf', // 'fwscanf', 'vscanf', 'vwscanf', 'vfscanf', 'vfwscanf', 'sscanf', // 'swscanf', 'vsscanf', 'vswscanf' without buffer limitations // is insecure. @@ -768,8 +769,9 @@ void WalkAST::checkDeprecatedOrUnsafeBufferHandling(const CallExpr *CE, int ArgIndex = llvm::StringSwitch(Name) .Cases("scanf", "wscanf", "vscanf", "vwscanf", 0) - .Cases("sprintf", "vsprintf", "fscanf", "fwscanf", "vfscanf", - "vfwscanf", "sscanf", "swscanf", "vsscanf", "vswscanf", 1) + .Cases("fscanf", "fwscanf", "vfscanf", "vfwscanf", "sscanf", + "swscanf", "vsscanf", "vswscanf", 1) + .Cases("sprintf", "vsprintf", "fprintf", 1) .Cases("swprintf", "snprintf", "vswprintf", "vsnprintf", "memcpy", "memmove", "memset", "strncpy", "strncat", DEPR_ONLY) .Default(UNKNOWN_CALL); diff --git a/clang/test/Analysis/security-syntax-checks.c b/clang/test/Analysis/security-syntax-checks.c index 392a65ff5f167c..2c904f41623fcd 100644 --- a/clang/test/Analysis/security-syntax-checks.c +++ b/clang/test/Analysis/security-syntax-checks.c @@ -5,15 +5,24 @@ // RUN: %clang_analyze_cc1 %s -verify -std=gnu99 \ // RUN: -analyzer-checker=security.insecureAPI +#include "Inputs/system-header-simulator.h" + +extern FILE *fp; +extern char buf[128]; + void builtin_function_call_crash_fixes(char *c) { __builtin_strncpy(c, "", 6); __builtin_memset(c, '\0', (0)); __builtin_memcpy(c, c, 0); + __builtin_sprintf(buf, "%s", c); + __builtin_fprintf(fp, "%s", c); #if __STDC_VERSION__ > 199901 - // expected-warning@-5{{Call to function 'strncpy' is insecure as it does not provide security checks introduced in the C11 standard.}} - // expected-warning@-5{{Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard.}} - // expected-warning@-5{{Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard.}} + // expected-warning@-7{{Call to function 'strncpy' is insecure as it does not provide security checks introduced in the C11 standard.}} + // expected-warning@-7{{Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard.}} + // expected-warning@-7{{Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard.}} + // expected-warning@-7{{Call to function 'sprintf' is insecure as it does not provide bounding of the memory buffer or security checks introduced in the C11 standard.}} + // expected-warning@-7{{Call to function 'fprintf' is insecure as it does not provide bounding of the memory buffer or security checks introduced in the C11 standard.}} #else // expected-no-diagnostics #endif From b98a594977f25e555822e5ceef457f69c73cce45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Endre=20F=C3=BCl=C3=B6p?= Date: Fri, 24 Nov 2023 10:02:56 +0100 Subject: [PATCH 02/35] [clang][analyzer] Move `security.cert.env.InvalidPtr` out of `alpha` (#71912) Thanks to recent improvements in #67663, InvalidPtr checker does not emit any false positives on the following OS projects: memcached, tmux, curl, twin, vim, openssl, sqlite, ffmpeg, postgres, tinyxml2, libwebm, xerces, bitcoin, protobuf, qtbase, contour, acid, openrct2. (Before the changes mentioned above, there were 27 reports, catching the `getenv` invalidates previous `getenv` results cases. That strict behaviour is disabled by default) --- clang/docs/analyzer/checkers.rst | 138 +++++++++--------- .../clang/StaticAnalyzer/Checkers/Checkers.td | 28 ++-- clang/test/Analysis/analyzer-config.c | 2 +- clang/test/Analysis/cert/env31-c.c | 10 +- .../Analysis/cert/env34-c-cert-examples.c | 16 +- clang/test/Analysis/cert/env34-c.c | 4 +- clang/test/Analysis/invalid-ptr-checker.c | 14 +- 7 files changed, 107 insertions(+), 105 deletions(-) diff --git a/clang/docs/analyzer/checkers.rst b/clang/docs/analyzer/checkers.rst index 40aa06724ccb75..f7b48e64e324f0 100644 --- a/clang/docs/analyzer/checkers.rst +++ b/clang/docs/analyzer/checkers.rst @@ -755,6 +755,75 @@ security Security related checkers. +.. _security-cert-env-InvalidPtr: + +security.cert.env.InvalidPtr +"""""""""""""""""""""""""""""""""" + +Corresponds to SEI CERT Rules `ENV31-C `_ and `ENV34-C `_. + +* **ENV31-C**: + Rule is about the possible problem with ``main`` function's third argument, environment pointer, + "envp". When environment array is modified using some modification function + such as ``putenv``, ``setenv`` or others, It may happen that memory is reallocated, + however "envp" is not updated to reflect the changes and points to old memory + region. + +* **ENV34-C**: + Some functions return a pointer to a statically allocated buffer. + Consequently, subsequent call of these functions will invalidate previous + pointer. These functions include: ``getenv``, ``localeconv``, ``asctime``, ``setlocale``, ``strerror`` + +.. code-block:: c + + int main(int argc, const char *argv[], const char *envp[]) { + if (setenv("MY_NEW_VAR", "new_value", 1) != 0) { + // setenv call may invalidate 'envp' + /* Handle error */ + } + if (envp != NULL) { + for (size_t i = 0; envp[i] != NULL; ++i) { + puts(envp[i]); + // envp may no longer point to the current environment + // this program has unanticipated behavior, since envp + // does not reflect changes made by setenv function. + } + } + return 0; + } + + void previous_call_invalidation() { + char *p, *pp; + + p = getenv("VAR"); + setenv("SOMEVAR", "VALUE", /*overwrite = */1); + // call to 'setenv' may invalidate p + + *p; + // dereferencing invalid pointer + } + + +The ``InvalidatingGetEnv`` option is available for treating ``getenv`` calls as +invalidating. When enabled, the checker issues a warning if ``getenv`` is called +multiple times and their results are used without first creating a copy. +This level of strictness might be considered overly pedantic for the commonly +used ``getenv`` implementations. + +To enable this option, use: +``-analyzer-config security.cert.env.InvalidPtr:InvalidatingGetEnv=true``. + +By default, this option is set to *false*. + +When this option is enabled, warnings will be generated for scenarios like the +following: + +.. code-block:: c + + char* p = getenv("VAR"); + char* pp = getenv("VAR2"); // assumes this call can invalidate `env` + strlen(p); // warns about accessing invalid ptr + .. _security-FloatLoopCounter: security.FloatLoopCounter (C) @@ -2549,75 +2618,6 @@ alpha.security.cert.env SEI CERT checkers of `Environment C coding rules `_. -.. _alpha-security-cert-env-InvalidPtr: - -alpha.security.cert.env.InvalidPtr -"""""""""""""""""""""""""""""""""" - -Corresponds to SEI CERT Rules ENV31-C and ENV34-C. - -ENV31-C: -Rule is about the possible problem with `main` function's third argument, environment pointer, -"envp". When environment array is modified using some modification function -such as putenv, setenv or others, It may happen that memory is reallocated, -however "envp" is not updated to reflect the changes and points to old memory -region. - -ENV34-C: -Some functions return a pointer to a statically allocated buffer. -Consequently, subsequent call of these functions will invalidate previous -pointer. These functions include: getenv, localeconv, asctime, setlocale, strerror - -.. code-block:: c - - int main(int argc, const char *argv[], const char *envp[]) { - if (setenv("MY_NEW_VAR", "new_value", 1) != 0) { - // setenv call may invalidate 'envp' - /* Handle error */ - } - if (envp != NULL) { - for (size_t i = 0; envp[i] != NULL; ++i) { - puts(envp[i]); - // envp may no longer point to the current environment - // this program has unanticipated behavior, since envp - // does not reflect changes made by setenv function. - } - } - return 0; - } - - void previous_call_invalidation() { - char *p, *pp; - - p = getenv("VAR"); - setenv("SOMEVAR", "VALUE", /*overwrite = */1); - // call to 'setenv' may invalidate p - - *p; - // dereferencing invalid pointer - } - - -The ``InvalidatingGetEnv`` option is available for treating getenv calls as -invalidating. When enabled, the checker issues a warning if getenv is called -multiple times and their results are used without first creating a copy. -This level of strictness might be considered overly pedantic for the commonly -used getenv implementations. - -To enable this option, use: -``-analyzer-config alpha.security.cert.env.InvalidPtr:InvalidatingGetEnv=true``. - -By default, this option is set to *false*. - -When this option is enabled, warnings will be generated for scenarios like the -following: - -.. code-block:: c - - char* p = getenv("VAR"); - char* pp = getenv("VAR2"); // assumes this call can invalidate `env` - strlen(p); // warns about accessing invalid ptr - alpha.security.taint ^^^^^^^^^^^^^^^^^^^^ diff --git a/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td b/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td index 7590a6d2b7522e..1d224786372e82 100644 --- a/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td +++ b/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td @@ -71,10 +71,12 @@ def InsecureAPI : Package<"insecureAPI">, ParentPackage; def SecurityAlpha : Package<"security">, ParentPackage; def Taint : Package<"taint">, ParentPackage; -def CERT : Package<"cert">, ParentPackage; -def POS : Package<"pos">, ParentPackage; +def CERT : Package<"cert">, ParentPackage; def ENV : Package<"env">, ParentPackage; +def CERTAlpha : Package<"cert">, ParentPackage; +def POSAlpha : Package<"pos">, ParentPackage; + def Unix : Package<"unix">; def UnixAlpha : Package<"unix">, ParentPackage; def CString : Package<"cstring">, ParentPackage; @@ -993,15 +995,6 @@ def FloatLoopCounter : Checker<"FloatLoopCounter">, } // end "security" -let ParentPackage = POS in { - - def PutenvWithAuto : Checker<"34c">, - HelpText<"Finds calls to the 'putenv' function which pass a pointer to " - "an automatic variable as the argument.">, - Documentation; - -} // end "alpha.cert.pos" - let ParentPackage = ENV in { def InvalidPtrChecker : Checker<"InvalidPtr">, @@ -1013,11 +1006,20 @@ let ParentPackage = ENV in { "standard), which can lead to false positives depending on " "implementation.", "false", - InAlpha>, + Released>, ]>, Documentation; -} // end "alpha.cert.env" +} // end "security.cert.env" + +let ParentPackage = POSAlpha in { + + def PutenvWithAuto : Checker<"34c">, + HelpText<"Finds calls to the 'putenv' function which pass a pointer to " + "an automatic variable as the argument.">, + Documentation; + +} // end "alpha.cert.pos" let ParentPackage = SecurityAlpha in { diff --git a/clang/test/Analysis/analyzer-config.c b/clang/test/Analysis/analyzer-config.c index 13b529c5d7a294..373017f4b18bfc 100644 --- a/clang/test/Analysis/analyzer-config.c +++ b/clang/test/Analysis/analyzer-config.c @@ -11,7 +11,6 @@ // CHECK-NEXT: alpha.osx.cocoa.DirectIvarAssignment:AnnotatedFunctions = false // CHECK-NEXT: alpha.security.MmapWriteExec:MmapProtExec = 0x04 // CHECK-NEXT: alpha.security.MmapWriteExec:MmapProtRead = 0x01 -// CHECK-NEXT: alpha.security.cert.env.InvalidPtr:InvalidatingGetEnv = false // CHECK-NEXT: alpha.security.taint.TaintPropagation:Config = "" // CHECK-NEXT: apply-fixits = false // CHECK-NEXT: assume-controlled-environment = false @@ -116,6 +115,7 @@ // CHECK-NEXT: region-store-small-array-limit = 5 // CHECK-NEXT: region-store-small-struct-limit = 2 // CHECK-NEXT: report-in-main-source-file = false +// CHECK-NEXT: security.cert.env.InvalidPtr:InvalidatingGetEnv = false // CHECK-NEXT: serialize-stats = false // CHECK-NEXT: silence-checkers = "" // CHECK-NEXT: stable-report-filename = false diff --git a/clang/test/Analysis/cert/env31-c.c b/clang/test/Analysis/cert/env31-c.c index feaa2baefea7c7..f7abc717229ea9 100644 --- a/clang/test/Analysis/cert/env31-c.c +++ b/clang/test/Analysis/cert/env31-c.c @@ -1,25 +1,25 @@ // RUN: %clang_analyze_cc1 -analyzer-output=text -Wno-unused %s \ -// RUN: -analyzer-checker=core,alpha.security.cert.env.InvalidPtr \ +// RUN: -analyzer-checker=core,security.cert.env.InvalidPtr \ // RUN: -verify=putenv,common \ // RUN: -DENV_INVALIDATING_CALL="putenv(\"X=Y\")" // // RUN: %clang_analyze_cc1 -analyzer-output=text -Wno-unused %s \ -// RUN: -analyzer-checker=core,alpha.security.cert.env.InvalidPtr \ +// RUN: -analyzer-checker=core,security.cert.env.InvalidPtr \ // RUN: -verify=putenvs,common \ // RUN: -DENV_INVALIDATING_CALL="_putenv_s(\"X\", \"Y\")" // // RUN: %clang_analyze_cc1 -analyzer-output=text -Wno-unused %s \ -// RUN: -analyzer-checker=core,alpha.security.cert.env.InvalidPtr \ +// RUN: -analyzer-checker=core,security.cert.env.InvalidPtr \ // RUN: -verify=wputenvs,common \ // RUN: -DENV_INVALIDATING_CALL="_wputenv_s(\"X\", \"Y\")" // // RUN: %clang_analyze_cc1 -analyzer-output=text -Wno-unused %s \ -// RUN: -analyzer-checker=core,alpha.security.cert.env.InvalidPtr \ +// RUN: -analyzer-checker=core,security.cert.env.InvalidPtr \ // RUN: -verify=setenv,common \ // RUN: -DENV_INVALIDATING_CALL="setenv(\"X\", \"Y\", 0)" // // RUN: %clang_analyze_cc1 -analyzer-output=text -Wno-unused %s \ -// RUN: -analyzer-checker=core,alpha.security.cert.env.InvalidPtr \ +// RUN: -analyzer-checker=core,security.cert.env.InvalidPtr \ // RUN: -verify=unsetenv,common \ // RUN: -DENV_INVALIDATING_CALL="unsetenv(\"X\")" diff --git a/clang/test/Analysis/cert/env34-c-cert-examples.c b/clang/test/Analysis/cert/env34-c-cert-examples.c index 6d6659e55d86b9..ca82844fd5f7e1 100644 --- a/clang/test/Analysis/cert/env34-c-cert-examples.c +++ b/clang/test/Analysis/cert/env34-c-cert-examples.c @@ -1,18 +1,18 @@ // Default options. -// RUN: %clang_analyze_cc1 \ -// RUN: -analyzer-checker=core,alpha.security.cert.env.InvalidPtr \ +// RUN: %clang_analyze_cc1 \ +// RUN: -analyzer-checker=core,security.cert.env.InvalidPtr \ // RUN: -verify -Wno-unused %s // // Test the laxer handling of getenv function (this is the default). -// RUN: %clang_analyze_cc1 \ -// RUN: -analyzer-checker=core,alpha.security.cert.env.InvalidPtr \ -// RUN: -analyzer-config alpha.security.cert.env.InvalidPtr:InvalidatingGetEnv=false \ +// RUN: %clang_analyze_cc1 \ +// RUN: -analyzer-checker=core,security.cert.env.InvalidPtr \ +// RUN: -analyzer-config security.cert.env.InvalidPtr:InvalidatingGetEnv=false \ // RUN: -verify -Wno-unused %s // // Test the stricter handling of getenv function. -// RUN: %clang_analyze_cc1 \ -// RUN: -analyzer-checker=core,alpha.security.cert.env.InvalidPtr \ -// RUN: -analyzer-config alpha.security.cert.env.InvalidPtr:InvalidatingGetEnv=true \ +// RUN: %clang_analyze_cc1 \ +// RUN: -analyzer-checker=core,security.cert.env.InvalidPtr \ +// RUN: -analyzer-config security.cert.env.InvalidPtr:InvalidatingGetEnv=true \ // RUN: -verify=expected,pedantic -Wno-unused %s #include "../Inputs/system-header-simulator.h" diff --git a/clang/test/Analysis/cert/env34-c.c b/clang/test/Analysis/cert/env34-c.c index 94bc2cf95ccc9b..d307f0d8f4bb01 100644 --- a/clang/test/Analysis/cert/env34-c.c +++ b/clang/test/Analysis/cert/env34-c.c @@ -1,6 +1,6 @@ // RUN: %clang_analyze_cc1 \ -// RUN: -analyzer-checker=alpha.security.cert.env.InvalidPtr\ -// RUN: -analyzer-config alpha.security.cert.env.InvalidPtr:InvalidatingGetEnv=true \ +// RUN: -analyzer-checker=security.cert.env.InvalidPtr\ +// RUN: -analyzer-config security.cert.env.InvalidPtr:InvalidatingGetEnv=true \ // RUN: -analyzer-output=text -verify -Wno-unused %s #include "../Inputs/system-header-simulator.h" diff --git a/clang/test/Analysis/invalid-ptr-checker.c b/clang/test/Analysis/invalid-ptr-checker.c index e8ffee7fb479dc..81bee58aac208f 100644 --- a/clang/test/Analysis/invalid-ptr-checker.c +++ b/clang/test/Analysis/invalid-ptr-checker.c @@ -1,12 +1,12 @@ -// RUN: %clang_analyze_cc1 \ -// RUN: -analyzer-checker=alpha.security.cert.env.InvalidPtr \ -// RUN: -analyzer-config alpha.security.cert.env.InvalidPtr:InvalidatingGetEnv=false \ +// RUN: %clang_analyze_cc1 \ +// RUN: -analyzer-checker=security.cert.env.InvalidPtr \ +// RUN: -analyzer-config security.cert.env.InvalidPtr:InvalidatingGetEnv=false \ // RUN: -analyzer-output=text -verify -Wno-unused %s // -// RUN: %clang_analyze_cc1 \ -// RUN: -analyzer-checker=alpha.security.cert.env.InvalidPtr \ -// RUN: -analyzer-config \ -// RUN: alpha.security.cert.env.InvalidPtr:InvalidatingGetEnv=true \ +// RUN: %clang_analyze_cc1 \ +// RUN: -analyzer-checker=security.cert.env.InvalidPtr \ +// RUN: -analyzer-config \ +// RUN: security.cert.env.InvalidPtr:InvalidatingGetEnv=true \ // RUN: -analyzer-output=text -verify=expected,pedantic -Wno-unused %s #include "Inputs/system-header-simulator.h" From 25b5e5c4e9a39a86ca3c1a05ad6eae33771ab052 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Fri, 24 Nov 2023 10:18:24 +0100 Subject: [PATCH 03/35] Update links in AttrDocs.td for coro_lifetimebound --- clang/include/clang/Basic/AttrDocs.td | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/clang/include/clang/Basic/AttrDocs.td b/clang/include/clang/Basic/AttrDocs.td index c74ec2bc1218aa..cfd806aa3a029b 100644 --- a/clang/include/clang/Basic/AttrDocs.td +++ b/clang/include/clang/Basic/AttrDocs.td @@ -7585,11 +7585,11 @@ def CoroLifetimeBoundDoc : Documentation { let Category = DocCatDecl; let Content = [{ The ``[[clang::coro_lifetimebound]]`` is a class attribute which can be applied -to a `coroutine return type (CRT) ` _ (i.e. +to a `coroutine return type (`CRT`_) (i.e. it should also be annotated with ``[[clang::coro_return_type]]``). -All parameters of a function are considered to be lifetime bound. See documentation -of ``[[clang::lifetimebound]]`` for more `details _`. +All parameters of a function are considered to be lifetime bound. See `documentation`_ +of ``[[clang::lifetimebound]]`` for more details. if the function returns a coroutine return type (CRT) annotated with ``[[clang::coro_lifetimebound]]``. Reference parameters of a coroutine are susceptible to capturing references to temporaries or local variables. @@ -7606,9 +7606,8 @@ For example, return coro(a); } -`Lifetime bound _` static analysis -can be used to detect such instances when coroutines capture references which may die earlier than the -coroutine frame itself. In the above example, if the CRT `task` is annotated with +Lifetime bound static analysis can be used to detect such instances when coroutines capture references +which may die earlier than the coroutine frame itself. In the above example, if the CRT `task` is annotated with ``[[clang::coro_lifetimebound]]``, then lifetime bound analysis would detect capturing reference to temporaries or return address of a local variable. @@ -7635,5 +7634,8 @@ Both coroutines and coroutine wrappers are part of this analysis. [[clang::coro_wrapper]] Task stack_reference(int a) { return coro(a); // warning: returning address of stack variable `a`. } + +.. _`documentation`: https://clang.llvm.org/docs/AttributeReference.html#lifetimebound +.. _`CRT`: https://clang.llvm.org/docs/AttributeReference.html#coro-return-type }]; } From 59edb432256064ee4f66c3a30fd4875030c5166b Mon Sep 17 00:00:00 2001 From: Ramkumar Ramachandra Date: Fri, 24 Nov 2023 09:40:52 +0000 Subject: [PATCH 04/35] clang/APINotes: squelch a -Wparantheses warning (NFC) --- clang/include/clang/APINotes/APINotesManager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/include/clang/APINotes/APINotesManager.h b/clang/include/clang/APINotes/APINotesManager.h index 823b52ed28b598..c19082fdb597d8 100644 --- a/clang/include/clang/APINotes/APINotesManager.h +++ b/clang/include/clang/APINotes/APINotesManager.h @@ -159,7 +159,7 @@ class APINotesManager { ArrayRef getCurrentModuleReaders() const { bool HasPublic = CurrentModuleReaders[ReaderKind::Public]; bool HasPrivate = CurrentModuleReaders[ReaderKind::Private]; - assert(!HasPrivate || HasPublic && "private module requires public module"); + assert(!HasPrivate || (HasPublic && "private module requires public module")); if (!HasPrivate && !HasPublic) return {}; return ArrayRef(CurrentModuleReaders).slice(0, HasPrivate ? 2 : 1); From 6b87d84ff45d03c244e7511fba9359776ce27977 Mon Sep 17 00:00:00 2001 From: Momchil Velikov Date: Fri, 24 Nov 2023 09:46:03 +0000 Subject: [PATCH 05/35] [MachineSink] Some more preserving of debug location when rematerialising an instruction to replace a COPY (#73155) Somewhat similar to ef9bcace834e63f25bbbc5e8e2b615f89d85fb2f ([MachineSink][AArch64] Preserve debug location when rematerialising an instruction to replace a COPY (#72685)) reuse the debug location of the COPY, iff the rematerialised instruction did not have a location. Fixes a regression in `DebugInfo/AArch64/constant-dbgloc.ll` after enabling sink-and-fold. --- llvm/lib/CodeGen/MachineSink.cpp | 4 +++- llvm/test/DebugInfo/AArch64/constant-dbgloc.ll | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/llvm/lib/CodeGen/MachineSink.cpp b/llvm/lib/CodeGen/MachineSink.cpp index 48f5a21406f08a..83d775055dfd73 100644 --- a/llvm/lib/CodeGen/MachineSink.cpp +++ b/llvm/lib/CodeGen/MachineSink.cpp @@ -506,7 +506,7 @@ bool MachineSinking::PerformSinkAndFold(MachineInstr &MI, MRI->clearKillFlags(UsedRegB); for (auto &[SinkDst, MaybeAM] : SinkInto) { - [[maybe_unused]] MachineInstr *New = nullptr; + MachineInstr *New = nullptr; LLVM_DEBUG(dbgs() << "Sinking copy of"; MI.dump(); dbgs() << "into"; SinkDst->dump()); if (SinkDst->isCopy()) { @@ -525,6 +525,8 @@ bool MachineSinking::PerformSinkAndFold(MachineInstr &MI, Register DstReg = SinkDst->getOperand(0).getReg(); TII->reMaterialize(*SinkDst->getParent(), InsertPt, DstReg, 0, MI, *TRI); New = &*std::prev(InsertPt); + if (!New->getDebugLoc()) + New->setDebugLoc(SinkDst->getDebugLoc()); } else { // Fold instruction into the addressing mode of a memory instruction. New = TII->emitLdStWithAddr(*SinkDst, MaybeAM); diff --git a/llvm/test/DebugInfo/AArch64/constant-dbgloc.ll b/llvm/test/DebugInfo/AArch64/constant-dbgloc.ll index 1281123360bfff..98ea453b2f9458 100644 --- a/llvm/test/DebugInfo/AArch64/constant-dbgloc.ll +++ b/llvm/test/DebugInfo/AArch64/constant-dbgloc.ll @@ -1,4 +1,4 @@ -; RUN: llc -filetype=asm %s -o - | FileCheck %s +; RUN: llc -filetype=asm --aarch64-enable-sink-fold=true %s -o - | FileCheck %s target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" target triple = "aarch64--linux-gnueabihf" From b3dd14ce07f2750ae1068fe62abbf2f3bd2cade8 Mon Sep 17 00:00:00 2001 From: David Green Date: Fri, 24 Nov 2023 10:00:00 +0000 Subject: [PATCH 06/35] [AArch64] Add extra vecreduce.fmul tests. NFC --- llvm/test/CodeGen/AArch64/vecreduce-fmul.ll | 448 ++++++++++++++++++++ 1 file changed, 448 insertions(+) create mode 100644 llvm/test/CodeGen/AArch64/vecreduce-fmul.ll diff --git a/llvm/test/CodeGen/AArch64/vecreduce-fmul.ll b/llvm/test/CodeGen/AArch64/vecreduce-fmul.ll new file mode 100644 index 00000000000000..ff2c5c44d41218 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/vecreduce-fmul.ll @@ -0,0 +1,448 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc -mtriple=aarch64-none-eabi -verify-machineinstrs %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-SD-NOFP16 +; RUN: llc -mtriple=aarch64-none-eabi -mattr=+fullfp16 -verify-machineinstrs %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-SD-FP16 + +define float @mul_HalfS(<2 x float> %bin.rdx) { +; CHECK-LABEL: mul_HalfS: +; CHECK: // %bb.0: +; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-NEXT: fmul s0, s0, v0.s[1] +; CHECK-NEXT: ret + %r = call fast float @llvm.vector.reduce.fmul.f32.v2f32(float 1.0, <2 x float> %bin.rdx) + ret float %r +} + +define half @mul_HalfH(<4 x half> %bin.rdx) { +; CHECK-SD-NOFP16-LABEL: mul_HalfH: +; CHECK-SD-NOFP16: // %bb.0: +; CHECK-SD-NOFP16-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-NOFP16-NEXT: mov h1, v0.h[1] +; CHECK-SD-NOFP16-NEXT: fcvt s2, h0 +; CHECK-SD-NOFP16-NEXT: fcvt s1, h1 +; CHECK-SD-NOFP16-NEXT: fmul s1, s2, s1 +; CHECK-SD-NOFP16-NEXT: mov h2, v0.h[2] +; CHECK-SD-NOFP16-NEXT: mov h0, v0.h[3] +; CHECK-SD-NOFP16-NEXT: fcvt h1, s1 +; CHECK-SD-NOFP16-NEXT: fcvt s2, h2 +; CHECK-SD-NOFP16-NEXT: fcvt s0, h0 +; CHECK-SD-NOFP16-NEXT: fcvt s1, h1 +; CHECK-SD-NOFP16-NEXT: fmul s1, s1, s2 +; CHECK-SD-NOFP16-NEXT: fcvt h1, s1 +; CHECK-SD-NOFP16-NEXT: fcvt s1, h1 +; CHECK-SD-NOFP16-NEXT: fmul s0, s1, s0 +; CHECK-SD-NOFP16-NEXT: fcvt h0, s0 +; CHECK-SD-NOFP16-NEXT: ret +; +; CHECK-SD-FP16-LABEL: mul_HalfH: +; CHECK-SD-FP16: // %bb.0: +; CHECK-SD-FP16-NEXT: // kill: def $d0 killed $d0 def $q0 +; CHECK-SD-FP16-NEXT: fmul h1, h0, v0.h[1] +; CHECK-SD-FP16-NEXT: fmul h1, h1, v0.h[2] +; CHECK-SD-FP16-NEXT: fmul h0, h1, v0.h[3] +; CHECK-SD-FP16-NEXT: ret + %r = call fast half @llvm.vector.reduce.fmul.f16.v4f16(half 1.0, <4 x half> %bin.rdx) + ret half %r +} + + +define half @mul_H(<8 x half> %bin.rdx) { +; CHECK-SD-NOFP16-LABEL: mul_H: +; CHECK-SD-NOFP16: // %bb.0: +; CHECK-SD-NOFP16-NEXT: mov h1, v0.h[1] +; CHECK-SD-NOFP16-NEXT: fcvt s2, h0 +; CHECK-SD-NOFP16-NEXT: fcvt s1, h1 +; CHECK-SD-NOFP16-NEXT: fmul s1, s2, s1 +; CHECK-SD-NOFP16-NEXT: mov h2, v0.h[2] +; CHECK-SD-NOFP16-NEXT: fcvt h1, s1 +; CHECK-SD-NOFP16-NEXT: fcvt s2, h2 +; CHECK-SD-NOFP16-NEXT: fcvt s1, h1 +; CHECK-SD-NOFP16-NEXT: fmul s1, s1, s2 +; CHECK-SD-NOFP16-NEXT: mov h2, v0.h[3] +; CHECK-SD-NOFP16-NEXT: fcvt h1, s1 +; CHECK-SD-NOFP16-NEXT: fcvt s2, h2 +; CHECK-SD-NOFP16-NEXT: fcvt s1, h1 +; CHECK-SD-NOFP16-NEXT: fmul s1, s1, s2 +; CHECK-SD-NOFP16-NEXT: mov h2, v0.h[4] +; CHECK-SD-NOFP16-NEXT: fcvt h1, s1 +; CHECK-SD-NOFP16-NEXT: fcvt s2, h2 +; CHECK-SD-NOFP16-NEXT: fcvt s1, h1 +; CHECK-SD-NOFP16-NEXT: fmul s1, s1, s2 +; CHECK-SD-NOFP16-NEXT: mov h2, v0.h[5] +; CHECK-SD-NOFP16-NEXT: fcvt h1, s1 +; CHECK-SD-NOFP16-NEXT: fcvt s2, h2 +; CHECK-SD-NOFP16-NEXT: fcvt s1, h1 +; CHECK-SD-NOFP16-NEXT: fmul s1, s1, s2 +; CHECK-SD-NOFP16-NEXT: mov h2, v0.h[6] +; CHECK-SD-NOFP16-NEXT: mov h0, v0.h[7] +; CHECK-SD-NOFP16-NEXT: fcvt h1, s1 +; CHECK-SD-NOFP16-NEXT: fcvt s2, h2 +; CHECK-SD-NOFP16-NEXT: fcvt s0, h0 +; CHECK-SD-NOFP16-NEXT: fcvt s1, h1 +; CHECK-SD-NOFP16-NEXT: fmul s1, s1, s2 +; CHECK-SD-NOFP16-NEXT: fcvt h1, s1 +; CHECK-SD-NOFP16-NEXT: fcvt s1, h1 +; CHECK-SD-NOFP16-NEXT: fmul s0, s1, s0 +; CHECK-SD-NOFP16-NEXT: fcvt h0, s0 +; CHECK-SD-NOFP16-NEXT: ret +; +; CHECK-SD-FP16-LABEL: mul_H: +; CHECK-SD-FP16: // %bb.0: +; CHECK-SD-FP16-NEXT: ext v1.16b, v0.16b, v0.16b, #8 +; CHECK-SD-FP16-NEXT: fmul v0.4h, v0.4h, v1.4h +; CHECK-SD-FP16-NEXT: fmul h1, h0, v0.h[1] +; CHECK-SD-FP16-NEXT: fmul h1, h1, v0.h[2] +; CHECK-SD-FP16-NEXT: fmul h0, h1, v0.h[3] +; CHECK-SD-FP16-NEXT: ret + %r = call fast half @llvm.vector.reduce.fmul.f16.v8f16(half 1.0, <8 x half> %bin.rdx) + ret half %r +} + +define float @mul_S(<4 x float> %bin.rdx) { +; CHECK-LABEL: mul_S: +; CHECK: // %bb.0: +; CHECK-NEXT: ext v1.16b, v0.16b, v0.16b, #8 +; CHECK-NEXT: fmul v0.2s, v0.2s, v1.2s +; CHECK-NEXT: fmul s0, s0, v0.s[1] +; CHECK-NEXT: ret + %r = call fast float @llvm.vector.reduce.fmul.f32.v4f32(float 1.0, <4 x float> %bin.rdx) + ret float %r +} + +define double @mul_D(<2 x double> %bin.rdx) { +; CHECK-LABEL: mul_D: +; CHECK: // %bb.0: +; CHECK-NEXT: fmul d0, d0, v0.d[1] +; CHECK-NEXT: ret + %r = call fast double @llvm.vector.reduce.fmul.f64.v2f64(double 1.0, <2 x double> %bin.rdx) + ret double %r +} + +define half @mul_2H(<16 x half> %bin.rdx) { +; CHECK-SD-NOFP16-LABEL: mul_2H: +; CHECK-SD-NOFP16: // %bb.0: +; CHECK-SD-NOFP16-NEXT: mov h2, v1.h[1] +; CHECK-SD-NOFP16-NEXT: mov h3, v0.h[1] +; CHECK-SD-NOFP16-NEXT: fcvt s4, h1 +; CHECK-SD-NOFP16-NEXT: fcvt s5, h0 +; CHECK-SD-NOFP16-NEXT: fcvt s2, h2 +; CHECK-SD-NOFP16-NEXT: fcvt s3, h3 +; CHECK-SD-NOFP16-NEXT: fmul s4, s5, s4 +; CHECK-SD-NOFP16-NEXT: mov h5, v0.h[2] +; CHECK-SD-NOFP16-NEXT: fmul s2, s3, s2 +; CHECK-SD-NOFP16-NEXT: mov h3, v1.h[2] +; CHECK-SD-NOFP16-NEXT: fcvt h4, s4 +; CHECK-SD-NOFP16-NEXT: fcvt s5, h5 +; CHECK-SD-NOFP16-NEXT: fcvt h2, s2 +; CHECK-SD-NOFP16-NEXT: fcvt s3, h3 +; CHECK-SD-NOFP16-NEXT: fcvt s4, h4 +; CHECK-SD-NOFP16-NEXT: fcvt s2, h2 +; CHECK-SD-NOFP16-NEXT: fmul s3, s5, s3 +; CHECK-SD-NOFP16-NEXT: mov h5, v0.h[3] +; CHECK-SD-NOFP16-NEXT: fmul s2, s4, s2 +; CHECK-SD-NOFP16-NEXT: mov h4, v1.h[3] +; CHECK-SD-NOFP16-NEXT: fcvt h3, s3 +; CHECK-SD-NOFP16-NEXT: fcvt s5, h5 +; CHECK-SD-NOFP16-NEXT: fcvt h2, s2 +; CHECK-SD-NOFP16-NEXT: fcvt s4, h4 +; CHECK-SD-NOFP16-NEXT: fcvt s3, h3 +; CHECK-SD-NOFP16-NEXT: fcvt s2, h2 +; CHECK-SD-NOFP16-NEXT: fmul s4, s5, s4 +; CHECK-SD-NOFP16-NEXT: mov h5, v0.h[4] +; CHECK-SD-NOFP16-NEXT: fmul s2, s2, s3 +; CHECK-SD-NOFP16-NEXT: mov h3, v1.h[4] +; CHECK-SD-NOFP16-NEXT: fcvt h4, s4 +; CHECK-SD-NOFP16-NEXT: fcvt s5, h5 +; CHECK-SD-NOFP16-NEXT: fcvt h2, s2 +; CHECK-SD-NOFP16-NEXT: fcvt s3, h3 +; CHECK-SD-NOFP16-NEXT: fcvt s4, h4 +; CHECK-SD-NOFP16-NEXT: fcvt s2, h2 +; CHECK-SD-NOFP16-NEXT: fmul s3, s5, s3 +; CHECK-SD-NOFP16-NEXT: mov h5, v0.h[5] +; CHECK-SD-NOFP16-NEXT: fmul s2, s2, s4 +; CHECK-SD-NOFP16-NEXT: mov h4, v1.h[5] +; CHECK-SD-NOFP16-NEXT: fcvt h3, s3 +; CHECK-SD-NOFP16-NEXT: fcvt s5, h5 +; CHECK-SD-NOFP16-NEXT: fcvt h2, s2 +; CHECK-SD-NOFP16-NEXT: fcvt s4, h4 +; CHECK-SD-NOFP16-NEXT: fcvt s3, h3 +; CHECK-SD-NOFP16-NEXT: fcvt s2, h2 +; CHECK-SD-NOFP16-NEXT: fmul s4, s5, s4 +; CHECK-SD-NOFP16-NEXT: mov h5, v0.h[6] +; CHECK-SD-NOFP16-NEXT: mov h0, v0.h[7] +; CHECK-SD-NOFP16-NEXT: fmul s2, s2, s3 +; CHECK-SD-NOFP16-NEXT: fcvt h3, s4 +; CHECK-SD-NOFP16-NEXT: mov h4, v1.h[6] +; CHECK-SD-NOFP16-NEXT: fcvt s5, h5 +; CHECK-SD-NOFP16-NEXT: mov h1, v1.h[7] +; CHECK-SD-NOFP16-NEXT: fcvt s0, h0 +; CHECK-SD-NOFP16-NEXT: fcvt h2, s2 +; CHECK-SD-NOFP16-NEXT: fcvt s3, h3 +; CHECK-SD-NOFP16-NEXT: fcvt s4, h4 +; CHECK-SD-NOFP16-NEXT: fcvt s1, h1 +; CHECK-SD-NOFP16-NEXT: fcvt s2, h2 +; CHECK-SD-NOFP16-NEXT: fmul s0, s0, s1 +; CHECK-SD-NOFP16-NEXT: fmul s2, s2, s3 +; CHECK-SD-NOFP16-NEXT: fmul s3, s5, s4 +; CHECK-SD-NOFP16-NEXT: fcvt h0, s0 +; CHECK-SD-NOFP16-NEXT: fcvt h2, s2 +; CHECK-SD-NOFP16-NEXT: fcvt h3, s3 +; CHECK-SD-NOFP16-NEXT: fcvt s0, h0 +; CHECK-SD-NOFP16-NEXT: fcvt s2, h2 +; CHECK-SD-NOFP16-NEXT: fcvt s3, h3 +; CHECK-SD-NOFP16-NEXT: fmul s2, s2, s3 +; CHECK-SD-NOFP16-NEXT: fcvt h1, s2 +; CHECK-SD-NOFP16-NEXT: fcvt s1, h1 +; CHECK-SD-NOFP16-NEXT: fmul s0, s1, s0 +; CHECK-SD-NOFP16-NEXT: fcvt h0, s0 +; CHECK-SD-NOFP16-NEXT: ret +; +; CHECK-SD-FP16-LABEL: mul_2H: +; CHECK-SD-FP16: // %bb.0: +; CHECK-SD-FP16-NEXT: fmul v0.8h, v0.8h, v1.8h +; CHECK-SD-FP16-NEXT: ext v1.16b, v0.16b, v0.16b, #8 +; CHECK-SD-FP16-NEXT: fmul v0.4h, v0.4h, v1.4h +; CHECK-SD-FP16-NEXT: fmul h1, h0, v0.h[1] +; CHECK-SD-FP16-NEXT: fmul h1, h1, v0.h[2] +; CHECK-SD-FP16-NEXT: fmul h0, h1, v0.h[3] +; CHECK-SD-FP16-NEXT: ret + %r = call fast half @llvm.vector.reduce.fmul.f16.v16f16(half 1.0, <16 x half> %bin.rdx) + ret half %r +} + +define float @mul_2S(<8 x float> %bin.rdx) { +; CHECK-LABEL: mul_2S: +; CHECK: // %bb.0: +; CHECK-NEXT: fmul v0.4s, v0.4s, v1.4s +; CHECK-NEXT: ext v1.16b, v0.16b, v0.16b, #8 +; CHECK-NEXT: fmul v0.2s, v0.2s, v1.2s +; CHECK-NEXT: fmul s0, s0, v0.s[1] +; CHECK-NEXT: ret + %r = call fast float @llvm.vector.reduce.fmul.f32.v8f32(float 1.0, <8 x float> %bin.rdx) + ret float %r +} + +define double @mul_2D(<4 x double> %bin.rdx) { +; CHECK-LABEL: mul_2D: +; CHECK: // %bb.0: +; CHECK-NEXT: fmul v0.2d, v0.2d, v1.2d +; CHECK-NEXT: fmul d0, d0, v0.d[1] +; CHECK-NEXT: ret + %r = call fast double @llvm.vector.reduce.fmul.f64.v4f64(double 1.0, <4 x double> %bin.rdx) + ret double %r +} + +; added at least one test where the start value is not 1.0. +define float @mul_S_init_42(<4 x float> %bin.rdx) { +; CHECK-LABEL: mul_S_init_42: +; CHECK: // %bb.0: +; CHECK-NEXT: ext v1.16b, v0.16b, v0.16b, #8 +; CHECK-NEXT: mov w8, #1109917696 // =0x42280000 +; CHECK-NEXT: fmul v0.2s, v0.2s, v1.2s +; CHECK-NEXT: fmov s1, w8 +; CHECK-NEXT: fmul s0, s0, v0.s[1] +; CHECK-NEXT: fmul s0, s0, s1 +; CHECK-NEXT: ret + %r = call fast float @llvm.vector.reduce.fmul.f32.v4f32(float 42.0, <4 x float> %bin.rdx) + ret float %r +} + + +define half @fmul_reduct_reassoc_v8f16(<8 x half> %a, <8 x half> %b) { +; CHECK-SD-NOFP16-LABEL: fmul_reduct_reassoc_v8f16: +; CHECK-SD-NOFP16: // %bb.0: +; CHECK-SD-NOFP16-NEXT: mov h2, v0.h[1] +; CHECK-SD-NOFP16-NEXT: mov h3, v1.h[1] +; CHECK-SD-NOFP16-NEXT: fcvt s4, h0 +; CHECK-SD-NOFP16-NEXT: fcvt s5, h1 +; CHECK-SD-NOFP16-NEXT: fcvt s2, h2 +; CHECK-SD-NOFP16-NEXT: fcvt s3, h3 +; CHECK-SD-NOFP16-NEXT: fmul s2, s4, s2 +; CHECK-SD-NOFP16-NEXT: fmul s3, s5, s3 +; CHECK-SD-NOFP16-NEXT: mov h4, v0.h[2] +; CHECK-SD-NOFP16-NEXT: mov h5, v1.h[2] +; CHECK-SD-NOFP16-NEXT: fcvt h2, s2 +; CHECK-SD-NOFP16-NEXT: fcvt h3, s3 +; CHECK-SD-NOFP16-NEXT: fcvt s4, h4 +; CHECK-SD-NOFP16-NEXT: fcvt s5, h5 +; CHECK-SD-NOFP16-NEXT: fcvt s2, h2 +; CHECK-SD-NOFP16-NEXT: fcvt s3, h3 +; CHECK-SD-NOFP16-NEXT: fmul s2, s2, s4 +; CHECK-SD-NOFP16-NEXT: fmul s3, s3, s5 +; CHECK-SD-NOFP16-NEXT: mov h4, v0.h[3] +; CHECK-SD-NOFP16-NEXT: mov h5, v1.h[3] +; CHECK-SD-NOFP16-NEXT: fcvt h2, s2 +; CHECK-SD-NOFP16-NEXT: fcvt h3, s3 +; CHECK-SD-NOFP16-NEXT: fcvt s4, h4 +; CHECK-SD-NOFP16-NEXT: fcvt s5, h5 +; CHECK-SD-NOFP16-NEXT: fcvt s2, h2 +; CHECK-SD-NOFP16-NEXT: fcvt s3, h3 +; CHECK-SD-NOFP16-NEXT: fmul s2, s2, s4 +; CHECK-SD-NOFP16-NEXT: fmul s3, s3, s5 +; CHECK-SD-NOFP16-NEXT: mov h4, v0.h[4] +; CHECK-SD-NOFP16-NEXT: mov h5, v1.h[4] +; CHECK-SD-NOFP16-NEXT: fcvt h2, s2 +; CHECK-SD-NOFP16-NEXT: fcvt h3, s3 +; CHECK-SD-NOFP16-NEXT: fcvt s4, h4 +; CHECK-SD-NOFP16-NEXT: fcvt s5, h5 +; CHECK-SD-NOFP16-NEXT: fcvt s2, h2 +; CHECK-SD-NOFP16-NEXT: fcvt s3, h3 +; CHECK-SD-NOFP16-NEXT: fmul s2, s2, s4 +; CHECK-SD-NOFP16-NEXT: fmul s3, s3, s5 +; CHECK-SD-NOFP16-NEXT: mov h4, v0.h[5] +; CHECK-SD-NOFP16-NEXT: mov h5, v1.h[5] +; CHECK-SD-NOFP16-NEXT: fcvt h2, s2 +; CHECK-SD-NOFP16-NEXT: fcvt h3, s3 +; CHECK-SD-NOFP16-NEXT: fcvt s4, h4 +; CHECK-SD-NOFP16-NEXT: fcvt s5, h5 +; CHECK-SD-NOFP16-NEXT: fcvt s2, h2 +; CHECK-SD-NOFP16-NEXT: fcvt s3, h3 +; CHECK-SD-NOFP16-NEXT: fmul s2, s2, s4 +; CHECK-SD-NOFP16-NEXT: fmul s3, s3, s5 +; CHECK-SD-NOFP16-NEXT: mov h4, v0.h[6] +; CHECK-SD-NOFP16-NEXT: mov h5, v1.h[6] +; CHECK-SD-NOFP16-NEXT: mov h1, v1.h[7] +; CHECK-SD-NOFP16-NEXT: mov h0, v0.h[7] +; CHECK-SD-NOFP16-NEXT: fcvt h2, s2 +; CHECK-SD-NOFP16-NEXT: fcvt h3, s3 +; CHECK-SD-NOFP16-NEXT: fcvt s4, h4 +; CHECK-SD-NOFP16-NEXT: fcvt s5, h5 +; CHECK-SD-NOFP16-NEXT: fcvt s0, h0 +; CHECK-SD-NOFP16-NEXT: fcvt s1, h1 +; CHECK-SD-NOFP16-NEXT: fcvt s2, h2 +; CHECK-SD-NOFP16-NEXT: fcvt s3, h3 +; CHECK-SD-NOFP16-NEXT: fmul s2, s2, s4 +; CHECK-SD-NOFP16-NEXT: fmul s3, s3, s5 +; CHECK-SD-NOFP16-NEXT: fcvt h2, s2 +; CHECK-SD-NOFP16-NEXT: fcvt h3, s3 +; CHECK-SD-NOFP16-NEXT: fcvt s2, h2 +; CHECK-SD-NOFP16-NEXT: fcvt s3, h3 +; CHECK-SD-NOFP16-NEXT: fmul s0, s2, s0 +; CHECK-SD-NOFP16-NEXT: fmul s1, s3, s1 +; CHECK-SD-NOFP16-NEXT: fcvt h0, s0 +; CHECK-SD-NOFP16-NEXT: fcvt h1, s1 +; CHECK-SD-NOFP16-NEXT: fcvt s1, h1 +; CHECK-SD-NOFP16-NEXT: fcvt s0, h0 +; CHECK-SD-NOFP16-NEXT: fmul s0, s0, s1 +; CHECK-SD-NOFP16-NEXT: fcvt h0, s0 +; CHECK-SD-NOFP16-NEXT: ret +; +; CHECK-SD-FP16-LABEL: fmul_reduct_reassoc_v8f16: +; CHECK-SD-FP16: // %bb.0: +; CHECK-SD-FP16-NEXT: fmul v0.8h, v0.8h, v1.8h +; CHECK-SD-FP16-NEXT: ext v1.16b, v0.16b, v0.16b, #8 +; CHECK-SD-FP16-NEXT: fmul v0.4h, v0.4h, v1.4h +; CHECK-SD-FP16-NEXT: fmul h1, h0, v0.h[1] +; CHECK-SD-FP16-NEXT: fmul h1, h1, v0.h[2] +; CHECK-SD-FP16-NEXT: fmul h0, h1, v0.h[3] +; CHECK-SD-FP16-NEXT: ret + %r1 = call fast half @llvm.vector.reduce.fmul.f16.v8f16(half 1.0, <8 x half> %a) + %r2 = call fast half @llvm.vector.reduce.fmul.f16.v8f16(half 1.0, <8 x half> %b) + %r = fmul fast half %r1, %r2 + ret half %r +} + +define float @fmul_reduct_reassoc_v8f32(<8 x float> %a, <8 x float> %b) { +; CHECK-LABEL: fmul_reduct_reassoc_v8f32: +; CHECK: // %bb.0: +; CHECK-NEXT: fmul v2.4s, v2.4s, v3.4s +; CHECK-NEXT: fmul v0.4s, v0.4s, v1.4s +; CHECK-NEXT: fmul v0.4s, v0.4s, v2.4s +; CHECK-NEXT: ext v1.16b, v0.16b, v0.16b, #8 +; CHECK-NEXT: fmul v0.2s, v0.2s, v1.2s +; CHECK-NEXT: fmul s0, s0, v0.s[1] +; CHECK-NEXT: ret + %r1 = call fast float @llvm.vector.reduce.fmul.f32.v8f32(float 1.0, <8 x float> %a) + %r2 = call fast float @llvm.vector.reduce.fmul.f32.v8f32(float 1.0, <8 x float> %b) + %r = fmul fast float %r1, %r2 + ret float %r +} + +define float @fmul_reduct_reassoc_v4f32(<4 x float> %a, <4 x float> %b) { +; CHECK-LABEL: fmul_reduct_reassoc_v4f32: +; CHECK: // %bb.0: +; CHECK-NEXT: fmul v0.4s, v0.4s, v1.4s +; CHECK-NEXT: ext v1.16b, v0.16b, v0.16b, #8 +; CHECK-NEXT: fmul v0.2s, v0.2s, v1.2s +; CHECK-NEXT: fmul s0, s0, v0.s[1] +; CHECK-NEXT: ret + %r1 = call fast float @llvm.vector.reduce.fmul.f32.v4f32(float 1.0, <4 x float> %a) + %r2 = call fast float @llvm.vector.reduce.fmul.f32.v4f32(float 1.0, <4 x float> %b) + %r = fmul fast float %r1, %r2 + ret float %r +} + +define float @fmul_reduct_reassoc_v4f32_init(float %i, <4 x float> %a, <4 x float> %b) { +; CHECK-LABEL: fmul_reduct_reassoc_v4f32_init: +; CHECK: // %bb.0: +; CHECK-NEXT: ext v3.16b, v1.16b, v1.16b, #8 +; CHECK-NEXT: fmul v1.2s, v1.2s, v3.2s +; CHECK-NEXT: ext v3.16b, v2.16b, v2.16b, #8 +; CHECK-NEXT: fmul s1, s1, v1.s[1] +; CHECK-NEXT: fmul v2.2s, v2.2s, v3.2s +; CHECK-NEXT: fmul s0, s0, s1 +; CHECK-NEXT: fmul s1, s2, v2.s[1] +; CHECK-NEXT: fmul s0, s0, s1 +; CHECK-NEXT: ret + %r1 = call fast float @llvm.vector.reduce.fmul.f32.v4f32(float %i, <4 x float> %a) + %r2 = call fast float @llvm.vector.reduce.fmul.f32.v4f32(float 1.0, <4 x float> %b) + %r = fmul fast float %r1, %r2 + ret float %r +} + +define float @fmul_reduct_reassoc_v4v8f32(<4 x float> %a, <8 x float> %b) { +; CHECK-LABEL: fmul_reduct_reassoc_v4v8f32: +; CHECK: // %bb.0: +; CHECK-NEXT: fmul v1.4s, v1.4s, v2.4s +; CHECK-NEXT: fmul v0.4s, v0.4s, v1.4s +; CHECK-NEXT: ext v1.16b, v0.16b, v0.16b, #8 +; CHECK-NEXT: fmul v0.2s, v0.2s, v1.2s +; CHECK-NEXT: fmul s0, s0, v0.s[1] +; CHECK-NEXT: ret + %r1 = call fast float @llvm.vector.reduce.fmul.f32.v4f32(float 1.0, <4 x float> %a) + %r2 = call fast float @llvm.vector.reduce.fmul.f32.v8f32(float 1.0, <8 x float> %b) + %r = fmul fast float %r1, %r2 + ret float %r +} + +define double @fmul_reduct_reassoc_v4f64(<4 x double> %a, <4 x double> %b) { +; CHECK-LABEL: fmul_reduct_reassoc_v4f64: +; CHECK: // %bb.0: +; CHECK-NEXT: fmul v2.2d, v2.2d, v3.2d +; CHECK-NEXT: fmul v0.2d, v0.2d, v1.2d +; CHECK-NEXT: fmul v0.2d, v0.2d, v2.2d +; CHECK-NEXT: fmul d0, d0, v0.d[1] +; CHECK-NEXT: ret + %r1 = call fast double @llvm.vector.reduce.fmul.f64.v4f64(double 1.0, <4 x double> %a) + %r2 = call fast double @llvm.vector.reduce.fmul.f64.v4f64(double 1.0, <4 x double> %b) + %r = fmul fast double %r1, %r2 + ret double %r +} + +define float @fmul_reduct_reassoc_v4f32_extrause(<4 x float> %a, <4 x float> %b) { +; CHECK-LABEL: fmul_reduct_reassoc_v4f32_extrause: +; CHECK: // %bb.0: +; CHECK-NEXT: ext v2.16b, v0.16b, v0.16b, #8 +; CHECK-NEXT: ext v3.16b, v1.16b, v1.16b, #8 +; CHECK-NEXT: fmul v0.2s, v0.2s, v2.2s +; CHECK-NEXT: fmul v1.2s, v1.2s, v3.2s +; CHECK-NEXT: fmul s0, s0, v0.s[1] +; CHECK-NEXT: fmul s1, s1, v1.s[1] +; CHECK-NEXT: fmul s1, s0, s1 +; CHECK-NEXT: fmul s0, s1, s0 +; CHECK-NEXT: ret + %r1 = call fast float @llvm.vector.reduce.fmul.f32.v4f32(float 1.0, <4 x float> %a) + %r2 = call fast float @llvm.vector.reduce.fmul.f32.v4f32(float 1.0, <4 x float> %b) + %r = fmul fast float %r1, %r2 + %p = fmul float %r, %r1 + ret float %p +} + +; Function Attrs: nounwind readnone +declare half @llvm.vector.reduce.fmul.f16.v4f16(half, <4 x half>) +declare half @llvm.vector.reduce.fmul.f16.v8f16(half, <8 x half>) +declare half @llvm.vector.reduce.fmul.f16.v16f16(half, <16 x half>) +declare float @llvm.vector.reduce.fmul.f32.v2f32(float, <2 x float>) +declare float @llvm.vector.reduce.fmul.f32.v4f32(float, <4 x float>) +declare float @llvm.vector.reduce.fmul.f32.v8f32(float, <8 x float>) +declare double @llvm.vector.reduce.fmul.f64.v2f64(double, <2 x double>) +declare double @llvm.vector.reduce.fmul.f64.v4f64(double, <4 x double>) From 8a02b70324f03967a6697c782d2b2436d1e1bac2 Mon Sep 17 00:00:00 2001 From: Aiden Grossman Date: Fri, 24 Nov 2023 02:15:34 -0800 Subject: [PATCH 07/35] [llvm-exegesis] Refactor ExecutableFunction to use a named constructor (#72837) This patch refactors ExecutableFunction to use a named constructor pattern, namely adding the create function, so that errors occurring during the creation of an ExecutableFunction can be propogated back up rather than having to deal with them in report_fatal_error. --- llvm/tools/llvm-exegesis/lib/Assembler.cpp | 26 +++++---- llvm/tools/llvm-exegesis/lib/Assembler.h | 17 ++++-- .../llvm-exegesis/lib/BenchmarkRunner.cpp | 57 +++++++++++++++---- .../llvm-exegesis/Common/AssemblerUtils.h | 10 +++- 4 files changed, 81 insertions(+), 29 deletions(-) diff --git a/llvm/tools/llvm-exegesis/lib/Assembler.cpp b/llvm/tools/llvm-exegesis/lib/Assembler.cpp index 167fb6373377c2..9ff33258e965f7 100644 --- a/llvm/tools/llvm-exegesis/lib/Assembler.cpp +++ b/llvm/tools/llvm-exegesis/lib/Assembler.cpp @@ -347,38 +347,44 @@ class TrackingSectionMemoryManager : public SectionMemoryManager { } // namespace -ExecutableFunction::ExecutableFunction( +Expected ExecutableFunction::create( std::unique_ptr TM, - object::OwningBinary &&ObjectFileHolder) - : Context(std::make_unique()) { + object::OwningBinary &&ObjectFileHolder) { assert(ObjectFileHolder.getBinary() && "cannot create object file"); + std::unique_ptr Ctx = std::make_unique(); // Initializing the execution engine. // We need to use the JIT EngineKind to be able to add an object file. LLVMLinkInMCJIT(); uintptr_t CodeSize = 0; std::string Error; - ExecEngine.reset( - EngineBuilder(createModule(Context, TM->createDataLayout())) + std::unique_ptr EE( + EngineBuilder(createModule(Ctx, TM->createDataLayout())) .setErrorStr(&Error) .setMCPU(TM->getTargetCPU()) .setEngineKind(EngineKind::JIT) .setMCJITMemoryManager( std::make_unique(&CodeSize)) .create(TM.release())); - if (!ExecEngine) - report_fatal_error(Twine(Error)); + if (!EE) + return make_error(Twine(Error), inconvertibleErrorCode()); // Adding the generated object file containing the assembled function. // The ExecutionEngine makes sure the object file is copied into an // executable page. - ExecEngine->addObjectFile(std::move(ObjectFileHolder)); + EE->addObjectFile(std::move(ObjectFileHolder)); // Fetching function bytes. - const uint64_t FunctionAddress = ExecEngine->getFunctionAddress(FunctionID); + const uint64_t FunctionAddress = EE->getFunctionAddress(FunctionID); assert(isAligned(kFunctionAlignment, FunctionAddress) && "function is not properly aligned"); - FunctionBytes = + StringRef FBytes = StringRef(reinterpret_cast(FunctionAddress), CodeSize); + return ExecutableFunction(std::move(Ctx), std::move(EE), FBytes); } +ExecutableFunction::ExecutableFunction(std::unique_ptr Ctx, + std::unique_ptr EE, + StringRef FB) + : FunctionBytes(FB), Context(std::move(Ctx)), ExecEngine(std::move(EE)) {} + Error getBenchmarkFunctionBytes(const StringRef InputData, std::vector &Bytes) { const auto Holder = getObjectFromBuffer(InputData); diff --git a/llvm/tools/llvm-exegesis/lib/Assembler.h b/llvm/tools/llvm-exegesis/lib/Assembler.h index 7c2a002967af72..5f1bf8cdfb7ad6 100644 --- a/llvm/tools/llvm-exegesis/lib/Assembler.h +++ b/llvm/tools/llvm-exegesis/lib/Assembler.h @@ -106,10 +106,11 @@ object::OwningBinary getObjectFromFile(StringRef Filename); // Consumes an ObjectFile containing a `void foo(char*)` function and make it // executable. -struct ExecutableFunction { - explicit ExecutableFunction( - std::unique_ptr TM, - object::OwningBinary &&ObjectFileHolder); +class ExecutableFunction { +public: + static Expected + create(std::unique_ptr TM, + object::OwningBinary &&ObjectFileHolder); // Retrieves the function as an array of bytes. StringRef getFunctionBytes() const { return FunctionBytes; } @@ -119,9 +120,15 @@ struct ExecutableFunction { ((void (*)(char *))(intptr_t)FunctionBytes.data())(Memory); } + StringRef FunctionBytes; + +private: + ExecutableFunction(std::unique_ptr Ctx, + std::unique_ptr EE, + StringRef FunctionBytes); + std::unique_ptr Context; std::unique_ptr ExecEngine; - StringRef FunctionBytes; }; // Copies benchmark function's bytes from benchmark object. diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp index 19d1867fac0e2b..85375dec2a44c3 100644 --- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp +++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp @@ -89,13 +89,25 @@ BenchmarkRunner::FunctionExecutor::runAndSample(const char *Counters) const { namespace { class InProcessFunctionExecutorImpl : public BenchmarkRunner::FunctionExecutor { public: + static Expected> + create(const LLVMState &State, object::OwningBinary Obj, + BenchmarkRunner::ScratchSpace *Scratch) { + Expected EF = + ExecutableFunction::create(State.createTargetMachine(), std::move(Obj)); + + if (!EF) + return EF.takeError(); + + return std::unique_ptr( + new InProcessFunctionExecutorImpl(State, std::move(*EF), Scratch)); + } + +private: InProcessFunctionExecutorImpl(const LLVMState &State, - object::OwningBinary Obj, + ExecutableFunction Function, BenchmarkRunner::ScratchSpace *Scratch) - : State(State), Function(State.createTargetMachine(), std::move(Obj)), - Scratch(Scratch) {} + : State(State), Function(std::move(Function)), Scratch(Scratch) {} -private: static void accumulateCounterValues(const llvm::SmallVector &NewValues, llvm::SmallVector *Result) { @@ -161,13 +173,24 @@ class InProcessFunctionExecutorImpl : public BenchmarkRunner::FunctionExecutor { class SubProcessFunctionExecutorImpl : public BenchmarkRunner::FunctionExecutor { public: + static Expected> + create(const LLVMState &State, object::OwningBinary Obj, + const BenchmarkKey &Key) { + Expected EF = + ExecutableFunction::create(State.createTargetMachine(), std::move(Obj)); + if (!EF) + return EF.takeError(); + + return std::unique_ptr( + new SubProcessFunctionExecutorImpl(State, std::move(*EF), Key)); + } + +private: SubProcessFunctionExecutorImpl(const LLVMState &State, - object::OwningBinary Obj, + ExecutableFunction Function, const BenchmarkKey &Key) - : State(State), Function(State.createTargetMachine(), std::move(Obj)), - Key(Key) {} + : State(State), Function(std::move(Function)), Key(Key) {} -private: enum ChildProcessExitCodeE { CounterFDReadFailed = 1, RSeqDisableFailed, @@ -497,17 +520,27 @@ BenchmarkRunner::createFunctionExecutor( object::OwningBinary ObjectFile, const BenchmarkKey &Key) const { switch (ExecutionMode) { - case ExecutionModeE::InProcess: - return std::make_unique( + case ExecutionModeE::InProcess: { + auto InProcessExecutorOrErr = InProcessFunctionExecutorImpl::create( State, std::move(ObjectFile), Scratch.get()); - case ExecutionModeE::SubProcess: + if (!InProcessExecutorOrErr) + return InProcessExecutorOrErr.takeError(); + + return std::move(*InProcessExecutorOrErr); + } + case ExecutionModeE::SubProcess: { #ifdef __linux__ - return std::make_unique( + auto SubProcessExecutorOrErr = SubProcessFunctionExecutorImpl::create( State, std::move(ObjectFile), Key); + if (!SubProcessExecutorOrErr) + return SubProcessExecutorOrErr.takeError(); + + return std::move(*SubProcessExecutorOrErr); #else return make_error( "The subprocess execution mode is only supported on Linux"); #endif + } } llvm_unreachable("ExecutionMode is outside expected range"); } diff --git a/llvm/unittests/tools/llvm-exegesis/Common/AssemblerUtils.h b/llvm/unittests/tools/llvm-exegesis/Common/AssemblerUtils.h index 02706ca4c64cd2..2804a6e69e824e 100644 --- a/llvm/unittests/tools/llvm-exegesis/Common/AssemblerUtils.h +++ b/llvm/unittests/tools/llvm-exegesis/Common/AssemblerUtils.h @@ -20,6 +20,7 @@ #include "llvm/MC/TargetRegistry.h" #include "llvm/Support/TargetSelect.h" #include "llvm/TargetParser/Host.h" +#include "llvm/Testing/Support/Error.h" #include "gmock/gmock.h" #include "gtest/gtest.h" @@ -82,8 +83,13 @@ class MachineFunctionGeneratorBaseTest : public ::testing::Test { EXPECT_FALSE(assembleToStream(*ET, createTargetMachine(), /*LiveIns=*/{}, RegisterInitialValues, Fill, AsmStream, Key, false)); - return ExecutableFunction(createTargetMachine(), - getObjectFromBuffer(AsmStream.str())); + Expected ExecFunc = ExecutableFunction::create( + createTargetMachine(), getObjectFromBuffer(AsmStream.str())); + + // We can't use ASSERT_THAT_EXPECTED here as it doesn't work inside of + // non-void functions. + EXPECT_TRUE(detail::TakeExpected(ExecFunc).Success()); + return std::move(*ExecFunc); } const std::string TT; From 17fcad7f84a831e52f30d6417d97707b91b9848d Mon Sep 17 00:00:00 2001 From: Aiden Grossman Date: Fri, 24 Nov 2023 02:20:58 -0800 Subject: [PATCH 08/35] [Github] Build clang docs in CI if autogenerated files change (#72623) These are unlikely to produce errors in the build, assuming that the tablegen emitter works as expected, but we're still losing some documentation build testing coverage but not building upon changes to these files. --- .github/workflows/docs.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index d872097b239d27..9c695e714edd63 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -15,6 +15,9 @@ on: paths: - 'llvm/docs/**' - 'clang/docs/**' + - 'clang/include/clang/Basic/AttrDocs.td' + - 'clang/include/clang/Driver/ClangOptionDocs.td' + - 'clang/include/clang/Basic/DiagnosticDocs.td' - 'clang-tools-extra/docs/**' - 'lldb/docs/**' - 'libunwind/docs/**' @@ -29,6 +32,9 @@ on: paths: - 'llvm/docs/**' - 'clang/docs/**' + - 'clang/include/clang/Basic/AttrDocs.td' + - 'clang/include/clang/Driver/ClangOptionDocs.td' + - 'clang/include/clang/Basic/DiagnosticDocs.td' - 'clang-tools-extra/docs/**' - 'lldb/docs/**' - 'libunwind/docs/**' @@ -64,6 +70,9 @@ jobs: - 'llvm/docs/**' clang: - 'clang/docs/**' + - 'clang/include/clang/Basic/AttrDocs.td' + - 'clang/include/clang/Driver/ClangOptionDocs.td' + - 'clang/include/clang/Basic/DiagnosticDocs.td' clang-tools-extra: - 'clang-tools-extra/docs/**' lldb: From 28233b11ac0efd28ab1f6c83842342d2e7f0a4d3 Mon Sep 17 00:00:00 2001 From: Jay Foad Date: Fri, 24 Nov 2023 10:23:06 +0000 Subject: [PATCH 09/35] [AMDGPU] New AMDGPUInsertSingleUseVDST pass (#72388) Add support for emitting GFX11.5 s_singleuse_vdst instructions. This is a power saving feature whereby the compiler can annotate VALU instructions whose results are known to have only a single use, so the hardware can in some cases avoid writing the result back to VGPR RAM. To begin with the pass is disabled by default because of one missing feature: we need an exclusion list of opcodes that never qualify as single-use producers and/or consumers. A future patch will implement this and enable the pass by default. --------- Co-authored-by: Scott Egerton --- llvm/lib/Target/AMDGPU/AMDGPU.h | 3 + .../AMDGPU/AMDGPUInsertSingleUseVDST.cpp | 122 ++++ .../lib/Target/AMDGPU/AMDGPUTargetMachine.cpp | 10 + llvm/lib/Target/AMDGPU/CMakeLists.txt | 1 + .../CodeGen/AMDGPU/insert-singleuse-vdst.mir | 627 ++++++++++++++++++ 5 files changed, 763 insertions(+) create mode 100644 llvm/lib/Target/AMDGPU/AMDGPUInsertSingleUseVDST.cpp create mode 100644 llvm/test/CodeGen/AMDGPU/insert-singleuse-vdst.mir diff --git a/llvm/lib/Target/AMDGPU/AMDGPU.h b/llvm/lib/Target/AMDGPU/AMDGPU.h index 403014db56171a..323560a46f31de 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPU.h +++ b/llvm/lib/Target/AMDGPU/AMDGPU.h @@ -335,6 +335,9 @@ extern char &SIModeRegisterID; void initializeAMDGPUInsertDelayAluPass(PassRegistry &); extern char &AMDGPUInsertDelayAluID; +void initializeAMDGPUInsertSingleUseVDSTPass(PassRegistry &); +extern char &AMDGPUInsertSingleUseVDSTID; + void initializeSIInsertHardClausesPass(PassRegistry &); extern char &SIInsertHardClausesID; diff --git a/llvm/lib/Target/AMDGPU/AMDGPUInsertSingleUseVDST.cpp b/llvm/lib/Target/AMDGPU/AMDGPUInsertSingleUseVDST.cpp new file mode 100644 index 00000000000000..93ed77bb6f7efe --- /dev/null +++ b/llvm/lib/Target/AMDGPU/AMDGPUInsertSingleUseVDST.cpp @@ -0,0 +1,122 @@ +//===- AMDGPUInsertSingleUseVDST.cpp - Insert s_singleuse_vdst instructions ==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +/// \file +/// Insert s_singleuse_vdst instructions on GFX11.5+ to mark regions of VALU +/// instructions that produce single-use VGPR values. If the value is forwarded +/// to the consumer instruction prior to VGPR writeback, the hardware can +/// then skip (kill) the VGPR write. +// +//===----------------------------------------------------------------------===// + +#include "AMDGPU.h" +#include "GCNSubtarget.h" +#include "MCTargetDesc/AMDGPUMCTargetDesc.h" +#include "SIInstrInfo.h" +#include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/CodeGen/MachineBasicBlock.h" +#include "llvm/CodeGen/MachineFunction.h" +#include "llvm/CodeGen/MachineFunctionPass.h" +#include "llvm/CodeGen/MachineInstr.h" +#include "llvm/CodeGen/MachineInstrBuilder.h" +#include "llvm/CodeGen/MachineOperand.h" +#include "llvm/CodeGen/Register.h" +#include "llvm/CodeGen/TargetSubtargetInfo.h" +#include "llvm/IR/DebugLoc.h" +#include "llvm/MC/MCRegister.h" +#include "llvm/Pass.h" + +using namespace llvm; + +#define DEBUG_TYPE "amdgpu-insert-single-use-vdst" + +namespace { +class AMDGPUInsertSingleUseVDST : public MachineFunctionPass { +private: + const SIInstrInfo *SII; + +public: + static char ID; + + AMDGPUInsertSingleUseVDST() : MachineFunctionPass(ID) {} + + void emitSingleUseVDST(MachineInstr &MI) const { + // Mark the following instruction as a single-use producer: + // s_singleuse_vdst { supr0: 1 } + BuildMI(*MI.getParent(), MI, DebugLoc(), SII->get(AMDGPU::S_SINGLEUSE_VDST)) + .addImm(0x1); + } + + bool runOnMachineFunction(MachineFunction &MF) override { + const auto &ST = MF.getSubtarget(); + if (!ST.hasVGPRSingleUseHintInsts()) + return false; + + SII = ST.getInstrInfo(); + const auto *TRI = &SII->getRegisterInfo(); + bool InstructionEmitted = false; + + for (MachineBasicBlock &MBB : MF) { + DenseMap RegisterUseCount; // TODO: MCRegUnits + + // Handle boundaries at the end of basic block separately to avoid + // false positives. If they are live at the end of a basic block then + // assume it has more uses later on. + for (const auto &Liveouts : MBB.liveouts()) + RegisterUseCount[Liveouts.PhysReg] = 2; + + for (MachineInstr &MI : reverse(MBB.instrs())) { + // All registers in all operands need to be single use for an + // instruction to be marked as a single use producer. + bool AllProducerOperandsAreSingleUse = true; + + for (const auto &Operand : MI.operands()) { + if (!Operand.isReg()) + continue; + const auto Reg = Operand.getReg(); + + // Count the number of times each register is read. + if (Operand.readsReg()) + RegisterUseCount[Reg]++; + + // Do not attempt to optimise across exec mask changes. + if (MI.modifiesRegister(AMDGPU::EXEC, TRI)) { + for (auto &UsedReg : RegisterUseCount) + UsedReg.second = 2; + } + + // If we are at the point where the register first became live, + // check if the operands are single use. + if (!MI.modifiesRegister(Reg, TRI)) + continue; + if (RegisterUseCount[Reg] > 1) + AllProducerOperandsAreSingleUse = false; + // Reset uses count when a register is no longer live. + RegisterUseCount.erase(Reg); + } + if (AllProducerOperandsAreSingleUse && SIInstrInfo::isVALU(MI)) { + // TODO: Replace with candidate logging for instruction grouping + // later. + emitSingleUseVDST(MI); + InstructionEmitted = true; + } + } + } + return InstructionEmitted; + } +}; +} // namespace + +char AMDGPUInsertSingleUseVDST::ID = 0; + +char &llvm::AMDGPUInsertSingleUseVDSTID = AMDGPUInsertSingleUseVDST::ID; + +INITIALIZE_PASS(AMDGPUInsertSingleUseVDST, DEBUG_TYPE, + "AMDGPU Insert SingleUseVDST", false, false) diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp index 951ed9420594b1..0c38fa32c6f33a 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp @@ -286,6 +286,12 @@ static cl::opt EnableSIModeRegisterPass( cl::init(true), cl::Hidden); +// Enable GFX11.5+ s_singleuse_vdst insertion +static cl::opt + EnableInsertSingleUseVDST("amdgpu-enable-single-use-vdst", + cl::desc("Enable s_singleuse_vdst insertion"), + cl::init(false), cl::Hidden); + // Enable GFX11+ s_delay_alu insertion static cl::opt EnableInsertDelayAlu("amdgpu-enable-delay-alu", @@ -404,6 +410,7 @@ extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAMDGPUTarget() { initializeAMDGPURewriteUndefForPHILegacyPass(*PR); initializeAMDGPUUnifyMetadataPass(*PR); initializeSIAnnotateControlFlowPass(*PR); + initializeAMDGPUInsertSingleUseVDSTPass(*PR); initializeAMDGPUInsertDelayAluPass(*PR); initializeSIInsertHardClausesPass(*PR); initializeSIInsertWaitcntsPass(*PR); @@ -1448,6 +1455,9 @@ void GCNPassConfig::addPreEmitPass() { // cases. addPass(&PostRAHazardRecognizerID); + if (isPassEnabled(EnableInsertSingleUseVDST, CodeGenOptLevel::Less)) + addPass(&AMDGPUInsertSingleUseVDSTID); + if (isPassEnabled(EnableInsertDelayAlu, CodeGenOptLevel::Less)) addPass(&AMDGPUInsertDelayAluID); diff --git a/llvm/lib/Target/AMDGPU/CMakeLists.txt b/llvm/lib/Target/AMDGPU/CMakeLists.txt index 0c0720890794b6..53a33f8210d2a8 100644 --- a/llvm/lib/Target/AMDGPU/CMakeLists.txt +++ b/llvm/lib/Target/AMDGPU/CMakeLists.txt @@ -77,6 +77,7 @@ add_llvm_target(AMDGPUCodeGen AMDGPUMacroFusion.cpp AMDGPUMCInstLower.cpp AMDGPUIGroupLP.cpp + AMDGPUInsertSingleUseVDST.cpp AMDGPUMIRFormatter.cpp AMDGPUOpenCLEnqueuedBlockLowering.cpp AMDGPUPerfHintAnalysis.cpp diff --git a/llvm/test/CodeGen/AMDGPU/insert-singleuse-vdst.mir b/llvm/test/CodeGen/AMDGPU/insert-singleuse-vdst.mir new file mode 100644 index 00000000000000..5b75e42b75d298 --- /dev/null +++ b/llvm/test/CodeGen/AMDGPU/insert-singleuse-vdst.mir @@ -0,0 +1,627 @@ +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 4 +# RUN: llc -march=amdgcn -mcpu=gfx1150 -mattr=+wavefrontsize32,-wavefrontsize64 -verify-machineinstrs -run-pass=amdgpu-insert-single-use-vdst %s -o - | FileCheck %s +# RUN: llc -march=amdgcn -mcpu=gfx1150 -mattr=-wavefrontsize32,+wavefrontsize64 -verify-machineinstrs -run-pass=amdgpu-insert-single-use-vdst %s -o - | FileCheck %s + +# One single-use producer. +--- +name: one_producer +tracksRegLiveness: true +body: | + ; CHECK-LABEL: name: one_producer + ; CHECK: bb.0: + ; CHECK-NEXT: successors: %bb.1(0x80000000) + ; CHECK-NEXT: liveins: $vgpr0 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: S_SINGLEUSE_VDST 1 + ; CHECK-NEXT: $vgpr1 = V_ADD_U32_e32 $vgpr0, $vgpr0, implicit $exec + ; CHECK-NEXT: $vgpr2 = V_ADD_U32_e32 $vgpr0, $vgpr1, implicit $exec + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.1: + ; CHECK-NEXT: liveins: $vgpr0, $vgpr2 + ; CHECK-NEXT: {{ $}} + bb.0: + liveins: $vgpr0 + $vgpr1 = V_ADD_U32_e32 $vgpr0, $vgpr0, implicit $exec + $vgpr2 = V_ADD_U32_e32 $vgpr0, $vgpr1, implicit $exec + bb.1: + liveins: $vgpr0, $vgpr2 +... + +# One single-use producer of a 64-bit value. +--- +name: one_producer_64bit +tracksRegLiveness: true +body: | + ; CHECK-LABEL: name: one_producer_64bit + ; CHECK: bb.0: + ; CHECK-NEXT: successors: %bb.1(0x80000000) + ; CHECK-NEXT: liveins: $vgpr0_vgpr1 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: S_SINGLEUSE_VDST 1 + ; CHECK-NEXT: $vgpr2_vgpr3 = V_LSHLREV_B64_e64 0, $vgpr0_vgpr1, implicit $exec + ; CHECK-NEXT: $vgpr4_vgpr5 = V_LSHLREV_B64_e64 0, $vgpr2_vgpr3, implicit $exec + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.1: + ; CHECK-NEXT: liveins: $vgpr4_vgpr5 + ; CHECK-NEXT: {{ $}} + bb.0: + liveins: $vgpr0_vgpr1 + $vgpr2_vgpr3 = V_LSHLREV_B64_e64 0, $vgpr0_vgpr1, implicit $exec + $vgpr4_vgpr5 = V_LSHLREV_B64_e64 0, $vgpr2_vgpr3, implicit $exec + bb.1: + liveins: $vgpr4_vgpr5 +... + +# Two consecutive single-use producers. +--- +name: two_producers +tracksRegLiveness: true +body: | + ; CHECK-LABEL: name: two_producers + ; CHECK: bb.0: + ; CHECK-NEXT: successors: %bb.1(0x80000000) + ; CHECK-NEXT: liveins: $vgpr0 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: S_SINGLEUSE_VDST 1 + ; CHECK-NEXT: $vgpr1 = V_ADD_U32_e32 $vgpr0, $vgpr0, implicit $exec + ; CHECK-NEXT: S_SINGLEUSE_VDST 1 + ; CHECK-NEXT: $vgpr2 = V_ADD_U32_e32 $vgpr0, $vgpr1, implicit $exec + ; CHECK-NEXT: $vgpr3 = V_ADD_U32_e32 $vgpr0, $vgpr2, implicit $exec + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.1: + ; CHECK-NEXT: liveins: $vgpr0, $vgpr3 + ; CHECK-NEXT: {{ $}} + bb.0: + liveins: $vgpr0 + $vgpr1 = V_ADD_U32_e32 $vgpr0, $vgpr0, implicit $exec + $vgpr2 = V_ADD_U32_e32 $vgpr0, $vgpr1, implicit $exec + $vgpr3 = V_ADD_U32_e32 $vgpr0, $vgpr2, implicit $exec + bb.1: + liveins: $vgpr0, $vgpr3 +... + +# Redefinitions of v0. +--- +name: redefinitions +tracksRegLiveness: true +body: | + ; CHECK-LABEL: name: redefinitions + ; CHECK: bb.0: + ; CHECK-NEXT: successors: %bb.1(0x80000000) + ; CHECK-NEXT: liveins: $vgpr0 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: S_SINGLEUSE_VDST 1 + ; CHECK-NEXT: $vgpr0 = V_MOV_B32_e32 $vgpr0, implicit $exec + ; CHECK-NEXT: S_SINGLEUSE_VDST 1 + ; CHECK-NEXT: $vgpr0 = V_MOV_B32_e32 $vgpr0, implicit $exec + ; CHECK-NEXT: S_SINGLEUSE_VDST 1 + ; CHECK-NEXT: $vgpr0 = V_MOV_B32_e32 $vgpr0, implicit $exec + ; CHECK-NEXT: S_SINGLEUSE_VDST 1 + ; CHECK-NEXT: $vgpr0 = V_MOV_B32_e32 $vgpr0, implicit $exec + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.1: + bb.0: + liveins: $vgpr0 + $vgpr0 = V_MOV_B32_e32 $vgpr0, implicit $exec + $vgpr0 = V_MOV_B32_e32 $vgpr0, implicit $exec + $vgpr0 = V_MOV_B32_e32 $vgpr0, implicit $exec + $vgpr0 = V_MOV_B32_e32 $vgpr0, implicit $exec + bb.1: +... + +# One producer with no consumers. +--- +name: no_consumer +tracksRegLiveness: true +body: | + ; CHECK-LABEL: name: no_consumer + ; CHECK: bb.0: + ; CHECK-NEXT: successors: %bb.1(0x80000000) + ; CHECK-NEXT: liveins: $vgpr0 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: S_SINGLEUSE_VDST 1 + ; CHECK-NEXT: $vgpr1 = V_ADD_U32_e32 $vgpr0, $vgpr0, implicit $exec + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.1: + bb.0: + liveins: $vgpr0 + $vgpr1 = V_ADD_U32_e32 $vgpr0, $vgpr0, implicit $exec + bb.1: +... + +# One consumer with two uses of the same value. +--- +name: one_consumer_two_uses +tracksRegLiveness: true +body: | + ; CHECK-LABEL: name: one_consumer_two_uses + ; CHECK: bb.0: + ; CHECK-NEXT: successors: %bb.1(0x80000000) + ; CHECK-NEXT: liveins: $vgpr0 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: $vgpr1 = V_MOV_B32_e32 $vgpr0, implicit $exec + ; CHECK-NEXT: $vgpr2 = V_ADD_U32_e32 $vgpr1, $vgpr1, implicit $exec + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.1: + ; CHECK-NEXT: liveins: $vgpr0, $vgpr2 + ; CHECK-NEXT: {{ $}} + bb.0: + liveins: $vgpr0 + $vgpr1 = V_MOV_B32_e32 $vgpr0, implicit $exec + $vgpr2 = V_ADD_U32_e32 $vgpr1, $vgpr1, implicit $exec + bb.1: + liveins: $vgpr0, $vgpr2 +... + +# A longer example. +--- +name: longer_example +tracksRegLiveness: true +body: | + ; CHECK-LABEL: name: longer_example + ; CHECK: bb.0: + ; CHECK-NEXT: successors: %bb.1(0x80000000) + ; CHECK-NEXT: liveins: $vgpr3, $vgpr5, $sgpr0, $sgpr2, $sgpr4, $sgpr5, $sgpr16, $sgpr17, $sgpr18, $sgpr19 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: S_SINGLEUSE_VDST 1 + ; CHECK-NEXT: $vgpr14 = V_MUL_F32_e32 $sgpr4, $vgpr3, implicit $exec, implicit $mode + ; CHECK-NEXT: $sgpr3 = S_MUL_F16 $sgpr0, $sgpr2, implicit $mode + ; CHECK-NEXT: S_SINGLEUSE_VDST 1 + ; CHECK-NEXT: $vgpr15 = V_MUL_F32_e32 $sgpr5, $vgpr3, implicit $exec, implicit $mode + ; CHECK-NEXT: $vgpr17 = V_FMA_F32_e64 0, $sgpr16, 0, $vgpr5, 0, $vgpr14, 0, 0, implicit $exec, implicit $mode + ; CHECK-NEXT: $sgpr1 = S_ADD_F16 $sgpr0, 15360, implicit $mode + ; CHECK-NEXT: S_SINGLEUSE_VDST 1 + ; CHECK-NEXT: $vgpr15 = V_FMA_F32_e64 0, $sgpr17, 0, $vgpr5, 0, $vgpr15, 0, 0, implicit $exec, implicit $mode + ; CHECK-NEXT: S_SINGLEUSE_VDST 1 + ; CHECK-NEXT: $vgpr14 = V_FMA_F32_e64 0, $sgpr18, 0, $vgpr15, 0, $vgpr17, 0, 0, implicit $exec, implicit $mode + ; CHECK-NEXT: $vgpr15 = V_FMA_F32_e64 0, $sgpr19, 0, $vgpr14, 0, $vgpr17, 0, 0, implicit $exec, implicit $mode + ; CHECK-NEXT: $vgpr16 = V_LOG_F32_e32 $vgpr15, implicit $exec, implicit $mode + ; CHECK-NEXT: $vgpr18 = V_EXP_F32_e32 $vgpr15, implicit $exec, implicit $mode + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.1: + ; CHECK-NEXT: liveins: $vgpr16, $vgpr18 + ; CHECK-NEXT: {{ $}} + bb.0: + liveins: $vgpr3, $vgpr5, $sgpr0, $sgpr2, $sgpr4, $sgpr5, $sgpr16, $sgpr17, $sgpr18, $sgpr19 + $vgpr14 = V_MUL_F32_e32 $sgpr4, $vgpr3, implicit $exec, implicit $mode + $sgpr3 = S_MUL_F16 $sgpr0, $sgpr2, implicit $mode + $vgpr15 = V_MUL_F32_e32 $sgpr5, $vgpr3, implicit $exec, implicit $mode + $vgpr17 = V_FMA_F32_e64 0, $sgpr16, 0, $vgpr5, 0, $vgpr14, 0, 0, implicit $exec, implicit $mode + $sgpr1 = S_ADD_F16 $sgpr0, 15360, implicit $mode + $vgpr15 = V_FMA_F32_e64 0, $sgpr17, 0, $vgpr5, 0, $vgpr15, 0, 0, implicit $exec, implicit $mode + $vgpr14 = V_FMA_F32_e64 0, $sgpr18, 0, $vgpr15, 0, $vgpr17, 0, 0, implicit $exec, implicit $mode + $vgpr15 = V_FMA_F32_e64 0, $sgpr19, 0, $vgpr14, 0, $vgpr17, 0, 0, implicit $exec, implicit $mode + $vgpr16 = V_LOG_F32_e32 $vgpr15, implicit $exec, implicit $mode + $vgpr18 = V_EXP_F32_e32 $vgpr15, implicit $exec, implicit $mode + bb.1: + liveins: $vgpr16, $vgpr18 +... + +# Multiple uses of v0. +--- +name: multiple_uses_1 +tracksRegLiveness: true +body: | + ; CHECK-LABEL: name: multiple_uses_1 + ; CHECK: bb.0: + ; CHECK-NEXT: successors: %bb.1(0x80000000) + ; CHECK-NEXT: liveins: $vgpr0 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: $vgpr0 = V_MOV_B32_e32 $vgpr0, implicit $exec + ; CHECK-NEXT: $vgpr1 = V_MOV_B32_e32 $vgpr0, implicit $exec + ; CHECK-NEXT: $vgpr2 = V_MOV_B32_e32 $vgpr0, implicit $exec + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.1: + ; CHECK-NEXT: liveins: $vgpr1, $vgpr2 + ; CHECK-NEXT: {{ $}} + bb.0: + liveins: $vgpr0 + $vgpr0 = V_MOV_B32_e32 $vgpr0, implicit $exec + $vgpr1 = V_MOV_B32_e32 $vgpr0, implicit $exec + $vgpr2 = V_MOV_B32_e32 $vgpr0, implicit $exec + bb.1: + liveins: $vgpr1, $vgpr2 +... + +# Multiple uses of v0 and redefinitions of v1 and v2. +--- +name: multiple_uses_2 +tracksRegLiveness: true +body: | + ; CHECK-LABEL: name: multiple_uses_2 + ; CHECK: bb.0: + ; CHECK-NEXT: successors: %bb.1(0x80000000) + ; CHECK-NEXT: liveins: $vgpr0 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: $vgpr0 = V_MOV_B32_e32 $vgpr0, implicit $exec + ; CHECK-NEXT: S_SINGLEUSE_VDST 1 + ; CHECK-NEXT: $vgpr1 = V_MOV_B32_e32 $vgpr0, implicit $exec + ; CHECK-NEXT: S_SINGLEUSE_VDST 1 + ; CHECK-NEXT: $vgpr2 = V_MOV_B32_e32 $vgpr0, implicit $exec + ; CHECK-NEXT: $vgpr0 = V_MOV_B32_e32 $vgpr0, implicit $exec + ; CHECK-NEXT: $vgpr1 = V_MOV_B32_e32 $vgpr0, implicit $exec + ; CHECK-NEXT: $vgpr2 = V_MOV_B32_e32 $vgpr0, implicit $exec + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.1: + ; CHECK-NEXT: liveins: $vgpr1, $vgpr2 + ; CHECK-NEXT: {{ $}} + bb.0: + liveins: $vgpr0 + $vgpr0 = V_MOV_B32_e32 $vgpr0, implicit $exec + $vgpr1 = V_MOV_B32_e32 $vgpr0, implicit $exec + $vgpr2 = V_MOV_B32_e32 $vgpr0, implicit $exec + $vgpr0 = V_MOV_B32_e32 $vgpr0, implicit $exec + $vgpr1 = V_MOV_B32_e32 $vgpr0, implicit $exec + $vgpr2 = V_MOV_B32_e32 $vgpr0, implicit $exec + bb.1: + liveins: $vgpr1, $vgpr2 +... + +# Multiple uses of all but v1. +--- +name: multiple_uses_3 +tracksRegLiveness: true +body: | + ; CHECK-LABEL: name: multiple_uses_3 + ; CHECK: bb.0: + ; CHECK-NEXT: successors: %bb.1(0x80000000) + ; CHECK-NEXT: liveins: $vgpr0 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: $vgpr0 = V_MOV_B32_e32 $vgpr0, implicit $exec + ; CHECK-NEXT: S_SINGLEUSE_VDST 1 + ; CHECK-NEXT: $vgpr1 = V_MOV_B32_e32 $vgpr0, implicit $exec + ; CHECK-NEXT: $vgpr2 = V_MOV_B32_e32 $vgpr0, implicit $exec + ; CHECK-NEXT: $vgpr3 = V_MOV_B32_e32 $vgpr1, implicit $exec + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.1: + ; CHECK-NEXT: liveins: $vgpr2, $vgpr3 + ; CHECK-NEXT: {{ $}} + bb.0: + liveins: $vgpr0 + $vgpr0 = V_MOV_B32_e32 $vgpr0, implicit $exec + $vgpr1 = V_MOV_B32_e32 $vgpr0, implicit $exec + $vgpr2 = V_MOV_B32_e32 $vgpr0, implicit $exec + $vgpr3 = V_MOV_B32_e32 $vgpr1, implicit $exec + bb.1: + liveins: $vgpr2, $vgpr3 +... + +# Results are live-in to another basic block. +--- +name: basic_block_1 +tracksRegLiveness: true +body: | + ; CHECK-LABEL: name: basic_block_1 + ; CHECK: bb.0: + ; CHECK-NEXT: successors: %bb.1(0x80000000) + ; CHECK-NEXT: liveins: $vgpr0 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: $vgpr0 = V_MOV_B32_e32 $vgpr0, implicit $exec + ; CHECK-NEXT: $vgpr1 = V_MOV_B32_e32 $vgpr0, implicit $exec + ; CHECK-NEXT: $vgpr2 = V_MOV_B32_e32 $vgpr0, implicit $exec + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.1: + ; CHECK-NEXT: successors: %bb.2(0x80000000) + ; CHECK-NEXT: liveins: $vgpr0, $vgpr1, $vgpr2 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: $vgpr0 = V_MOV_B32_e32 $vgpr0, implicit $exec + ; CHECK-NEXT: $vgpr1 = V_MOV_B32_e32 $vgpr0, implicit $exec + ; CHECK-NEXT: $vgpr2 = V_MOV_B32_e32 $vgpr0, implicit $exec + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.2: + ; CHECK-NEXT: liveins: $vgpr1, $vgpr2 + ; CHECK-NEXT: {{ $}} + bb.0: + liveins: $vgpr0 + $vgpr0 = V_MOV_B32_e32 $vgpr0, implicit $exec + $vgpr1 = V_MOV_B32_e32 $vgpr0, implicit $exec + $vgpr2 = V_MOV_B32_e32 $vgpr0, implicit $exec + bb.1: + liveins: $vgpr0, $vgpr1, $vgpr2 + $vgpr0 = V_MOV_B32_e32 $vgpr0, implicit $exec + $vgpr1 = V_MOV_B32_e32 $vgpr0, implicit $exec + $vgpr2 = V_MOV_B32_e32 $vgpr0, implicit $exec + bb.2: + liveins: $vgpr1, $vgpr2 +... + +# Result v2 has multiple uses in another basic block. +--- +name: basic_block_2 +tracksRegLiveness: true +body: | + ; CHECK-LABEL: name: basic_block_2 + ; CHECK: bb.0: + ; CHECK-NEXT: successors: %bb.1(0x80000000) + ; CHECK-NEXT: liveins: $vgpr0, $vgpr1 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: $vgpr2 = V_MOV_B32_e32 $vgpr1, implicit $exec + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.1: + ; CHECK-NEXT: successors: %bb.2(0x80000000) + ; CHECK-NEXT: liveins: $vgpr2 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: S_SINGLEUSE_VDST 1 + ; CHECK-NEXT: $vgpr3 = V_MOV_B32_e32 $vgpr2, implicit $exec + ; CHECK-NEXT: $vgpr3 = V_MOV_B32_e32 $vgpr2, implicit $exec + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.2: + ; CHECK-NEXT: liveins: $vgpr3 + ; CHECK-NEXT: {{ $}} + bb.0: + liveins: $vgpr0, $vgpr1 + $vgpr2 = V_MOV_B32_e32 $vgpr1, implicit $exec + bb.1: + liveins: $vgpr2 + $vgpr3 = V_MOV_B32_e32 $vgpr2, implicit $exec + $vgpr3 = V_MOV_B32_e32 $vgpr2, implicit $exec + bb.2: + liveins: $vgpr3 +... + +# Results are redefined in another basic block. +--- +name: basic_block_3 +tracksRegLiveness: true +body: | + ; CHECK-LABEL: name: basic_block_3 + ; CHECK: bb.0: + ; CHECK-NEXT: successors: %bb.1(0x80000000) + ; CHECK-NEXT: liveins: $vgpr0 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: $vgpr0 = V_MOV_B32_e32 $vgpr0, implicit $exec + ; CHECK-NEXT: $vgpr1 = V_MOV_B32_e32 $vgpr0, implicit $exec + ; CHECK-NEXT: S_SINGLEUSE_VDST 1 + ; CHECK-NEXT: $vgpr2 = V_MOV_B32_e32 $vgpr0, implicit $exec + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.1: + ; CHECK-NEXT: successors: %bb.2(0x80000000) + ; CHECK-NEXT: liveins: $vgpr0, $vgpr1 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: $vgpr0 = V_ADD_U32_e32 $vgpr0, $vgpr1, implicit $exec + ; CHECK-NEXT: $vgpr1 = V_ADD_U32_e32 $vgpr0, $vgpr1, implicit $exec + ; CHECK-NEXT: $vgpr2 = V_ADD_U32_e32 $vgpr0, $vgpr1, implicit $exec + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.2: + ; CHECK-NEXT: liveins: $vgpr0, $vgpr1, $vgpr2 + ; CHECK-NEXT: {{ $}} + bb.0: + liveins: $vgpr0 + $vgpr0 = V_MOV_B32_e32 $vgpr0, implicit $exec + $vgpr1 = V_MOV_B32_e32 $vgpr0, implicit $exec + $vgpr2 = V_MOV_B32_e32 $vgpr0, implicit $exec + bb.1: + liveins: $vgpr0, $vgpr1 + $vgpr0 = V_ADD_U32_e32 $vgpr0, $vgpr1, implicit $exec + $vgpr1 = V_ADD_U32_e32 $vgpr0, $vgpr1, implicit $exec + $vgpr2 = V_ADD_U32_e32 $vgpr0, $vgpr1, implicit $exec + bb.2: + liveins: $vgpr0, $vgpr1, $vgpr2 +... + +# Exec modified between producer and consumer. +--- +name: exec_mask +tracksRegLiveness: true +body: | + ; CHECK-LABEL: name: exec_mask + ; CHECK: bb.0: + ; CHECK-NEXT: successors: %bb.1(0x80000000) + ; CHECK-NEXT: liveins: $sgpr0_sgpr1 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: S_SINGLEUSE_VDST 1 + ; CHECK-NEXT: $vgpr0 = V_MOV_B32_e32 0, implicit $exec + ; CHECK-NEXT: $exec = COPY $sgpr0_sgpr1 + ; CHECK-NEXT: $vgpr0 = V_MOV_B32_e32 $vgpr0, implicit $exec + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.1: + ; CHECK-NEXT: liveins: $vgpr0 + ; CHECK-NEXT: {{ $}} + bb.0: + liveins: $sgpr0_sgpr1 + $vgpr0 = V_MOV_B32_e32 0, implicit $exec + $exec = COPY $sgpr0_sgpr1 + $vgpr0 = V_MOV_B32_e32 $vgpr0, implicit $exec + bb.1: + liveins: $vgpr0 +... + +# Exec_lo modified between producer and consumer. +--- +name: exec_mask_lo +tracksRegLiveness: true +body: | + ; CHECK-LABEL: name: exec_mask_lo + ; CHECK: bb.0: + ; CHECK-NEXT: successors: %bb.1(0x80000000) + ; CHECK-NEXT: liveins: $sgpr0 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: S_SINGLEUSE_VDST 1 + ; CHECK-NEXT: $vgpr0 = V_MOV_B32_e32 0, implicit $exec + ; CHECK-NEXT: $exec_lo = COPY $sgpr0 + ; CHECK-NEXT: $vgpr0 = V_MOV_B32_e32 $vgpr0, implicit $exec + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.1: + ; CHECK-NEXT: liveins: $vgpr0 + ; CHECK-NEXT: {{ $}} + bb.0: + liveins: $sgpr0 + $vgpr0 = V_MOV_B32_e32 0, implicit $exec + $exec_lo = COPY $sgpr0 + $vgpr0 = V_MOV_B32_e32 $vgpr0, implicit $exec + bb.1: + liveins: $vgpr0 +... + +# Exec_hi modified between producer and consumer. +--- +name: exec_mask_hi +tracksRegLiveness: true +body: | + ; CHECK-LABEL: name: exec_mask_hi + ; CHECK: bb.0: + ; CHECK-NEXT: successors: %bb.1(0x80000000) + ; CHECK-NEXT: liveins: $sgpr0 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: S_SINGLEUSE_VDST 1 + ; CHECK-NEXT: $vgpr0 = V_MOV_B32_e32 0, implicit $exec + ; CHECK-NEXT: $exec_hi = COPY $sgpr0 + ; CHECK-NEXT: $vgpr0 = V_MOV_B32_e32 $vgpr0, implicit $exec + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.1: + ; CHECK-NEXT: liveins: $vgpr0 + ; CHECK-NEXT: {{ $}} + bb.0: + liveins: $sgpr0 + $vgpr0 = V_MOV_B32_e32 0, implicit $exec + $exec_hi = COPY $sgpr0 + $vgpr0 = V_MOV_B32_e32 $vgpr0, implicit $exec + bb.1: + liveins: $vgpr0 +... + +# Write 32-bit vgpr and then read from low 16 bits. +--- +name: write_full_read_lo +tracksRegLiveness: true +body: | + ; CHECK-LABEL: name: write_full_read_lo + ; CHECK: bb.0: + ; CHECK-NEXT: successors: %bb.1(0x80000000) + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: S_SINGLEUSE_VDST 1 + ; CHECK-NEXT: $vgpr0 = V_MOV_B32_e32 0, implicit $exec + ; CHECK-NEXT: $vgpr1_lo16 = V_MOV_B16_t16_e32 $vgpr0_lo16, implicit $exec + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.1: + ; CHECK-NEXT: liveins: $vgpr1_lo16 + ; CHECK-NEXT: {{ $}} + bb.0: + $vgpr0 = V_MOV_B32_e32 0, implicit $exec + $vgpr1_lo16 = V_MOV_B16_t16_e32 $vgpr0_lo16, implicit $exec + bb.1: + liveins: $vgpr1_lo16 +... + +# Write 32-bit vgpr and then read from high 16 bits. +--- +name: write_full_read_hi +tracksRegLiveness: true +body: | + ; CHECK-LABEL: name: write_full_read_hi + ; CHECK: bb.0: + ; CHECK-NEXT: successors: %bb.1(0x80000000) + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: S_SINGLEUSE_VDST 1 + ; CHECK-NEXT: $vgpr0 = V_MOV_B32_e32 0, implicit $exec + ; CHECK-NEXT: $vgpr1_hi16 = V_MOV_B16_t16_e32 $vgpr0_hi16, implicit $exec + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.1: + ; CHECK-NEXT: liveins: $vgpr1_hi16 + ; CHECK-NEXT: {{ $}} + bb.0: + $vgpr0 = V_MOV_B32_e32 0, implicit $exec + $vgpr1_hi16 = V_MOV_B16_t16_e32 $vgpr0_hi16, implicit $exec + bb.1: + liveins: $vgpr1_hi16 +... + +# Write 32-bit vgpr and then read from both halves. +--- +name: write_full_read_both +tracksRegLiveness: true +body: | + ; CHECK-LABEL: name: write_full_read_both + ; CHECK: bb.0: + ; CHECK-NEXT: successors: %bb.1(0x80000000) + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: S_SINGLEUSE_VDST 1 + ; CHECK-NEXT: $vgpr0 = V_MOV_B32_e32 0, implicit $exec + ; CHECK-NEXT: S_SINGLEUSE_VDST 1 + ; CHECK-NEXT: $vgpr1_lo16 = V_MOV_B16_t16_e32 $vgpr0_lo16, implicit $exec + ; CHECK-NEXT: S_SINGLEUSE_VDST 1 + ; CHECK-NEXT: $vgpr1_hi16 = V_MOV_B16_t16_e32 $vgpr0_hi16, implicit $exec + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.1: + ; CHECK-NEXT: liveins: $vgpr1 + ; CHECK-NEXT: {{ $}} + bb.0: + $vgpr0 = V_MOV_B32_e32 0, implicit $exec + $vgpr1_lo16 = V_MOV_B16_t16_e32 $vgpr0_lo16, implicit $exec + $vgpr1_hi16 = V_MOV_B16_t16_e32 $vgpr0_hi16, implicit $exec + bb.1: + liveins: $vgpr1 +... + +# Write 32-bit vgpr and then read from both halves in the same instruction. +--- +name: write_full_read_both_same_instruction +tracksRegLiveness: true +body: | + ; CHECK-LABEL: name: write_full_read_both_same_instruction + ; CHECK: bb.0: + ; CHECK-NEXT: successors: %bb.1(0x80000000) + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: S_SINGLEUSE_VDST 1 + ; CHECK-NEXT: $vgpr0 = V_MOV_B32_e32 0, implicit $exec + ; CHECK-NEXT: $vgpr1_lo16 = V_ADD_F16_t16_e32 $vgpr0_lo16, $vgpr0_hi16, implicit $mode, implicit $exec + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.1: + ; CHECK-NEXT: liveins: $vgpr1_lo16 + ; CHECK-NEXT: {{ $}} + bb.0: + $vgpr0 = V_MOV_B32_e32 0, implicit $exec + $vgpr1_lo16 = V_ADD_F16_t16_e32 $vgpr0_lo16, $vgpr0_hi16, implicit $mode, implicit $exec + bb.1: + liveins: $vgpr1_lo16 +... + +# Write low 16-bits and then read 32-bit vgpr. +--- +name: write_lo_read_full +tracksRegLiveness: true +body: | + ; CHECK-LABEL: name: write_lo_read_full + ; CHECK: bb.0: + ; CHECK-NEXT: successors: %bb.1(0x80000000) + ; CHECK-NEXT: liveins: $vgpr0 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: S_SINGLEUSE_VDST 1 + ; CHECK-NEXT: $vgpr0_lo16 = V_MOV_B16_t16_e32 0, implicit $exec + ; CHECK-NEXT: $vgpr1 = V_MOV_B32_e32 $vgpr0, implicit $exec + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.1: + ; CHECK-NEXT: liveins: $vgpr1 + ; CHECK-NEXT: {{ $}} + bb.0: + liveins: $vgpr0 + $vgpr0_lo16 = V_MOV_B16_t16_e32 0, implicit $exec + $vgpr1 = V_MOV_B32_e32 $vgpr0, implicit $exec + bb.1: + liveins: $vgpr1 +... + +# Write high 16-bits and then read 32-bit vgpr. +--- +name: write_hi_read_full +tracksRegLiveness: true +body: | + ; CHECK-LABEL: name: write_hi_read_full + ; CHECK: bb.0: + ; CHECK-NEXT: successors: %bb.1(0x80000000) + ; CHECK-NEXT: liveins: $vgpr0 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: S_SINGLEUSE_VDST 1 + ; CHECK-NEXT: $vgpr0_hi16 = V_MOV_B16_t16_e32 0, implicit $exec + ; CHECK-NEXT: $vgpr1 = V_MOV_B32_e32 $vgpr0, implicit $exec + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.1: + ; CHECK-NEXT: liveins: $vgpr1 + ; CHECK-NEXT: {{ $}} + bb.0: + liveins: $vgpr0 + $vgpr0_hi16 = V_MOV_B16_t16_e32 0, implicit $exec + $vgpr1 = V_MOV_B32_e32 $vgpr0, implicit $exec + bb.1: + liveins: $vgpr1 +... From 3049c76e43be0db265ea4b2a0497adabc88edcc5 Mon Sep 17 00:00:00 2001 From: Kai Wang Date: Fri, 24 Nov 2023 10:29:43 +0000 Subject: [PATCH 10/35] [mlir][vector][spirv] Lower vector.load and vector.store to SPIR-V (#71674) Add patterns to lower vector.load to spirv.load and vector.store to spirv.store. --- .../VectorToSPIRV/VectorToSPIRV.cpp | 89 +++++++++++++-- .../VectorToSPIRV/vector-to-spirv.mlir | 102 ++++++++++++++++++ 2 files changed, 182 insertions(+), 9 deletions(-) diff --git a/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp b/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp index 9b29179f368716..dcc6449d3fe892 100644 --- a/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp +++ b/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp @@ -509,6 +509,76 @@ struct VectorShuffleOpConvert final } }; +struct VectorLoadOpConverter final + : public OpConversionPattern { + using OpConversionPattern::OpConversionPattern; + + LogicalResult + matchAndRewrite(vector::LoadOp loadOp, OpAdaptor adaptor, + ConversionPatternRewriter &rewriter) const override { + auto memrefType = loadOp.getMemRefType(); + auto attr = + dyn_cast_or_null(memrefType.getMemorySpace()); + if (!attr) + return rewriter.notifyMatchFailure( + loadOp, "expected spirv.storage_class memory space"); + + const auto &typeConverter = *getTypeConverter(); + auto loc = loadOp.getLoc(); + Value accessChain = + spirv::getElementPtr(typeConverter, memrefType, adaptor.getBase(), + adaptor.getIndices(), loc, rewriter); + if (!accessChain) + return rewriter.notifyMatchFailure( + loadOp, "failed to get memref element pointer"); + + spirv::StorageClass storageClass = attr.getValue(); + auto vectorType = loadOp.getVectorType(); + auto vectorPtrType = spirv::PointerType::get(vectorType, storageClass); + Value castedAccessChain = + rewriter.create(loc, vectorPtrType, accessChain); + rewriter.replaceOpWithNewOp(loadOp, vectorType, + castedAccessChain); + + return success(); + } +}; + +struct VectorStoreOpConverter final + : public OpConversionPattern { + using OpConversionPattern::OpConversionPattern; + + LogicalResult + matchAndRewrite(vector::StoreOp storeOp, OpAdaptor adaptor, + ConversionPatternRewriter &rewriter) const override { + auto memrefType = storeOp.getMemRefType(); + auto attr = + dyn_cast_or_null(memrefType.getMemorySpace()); + if (!attr) + return rewriter.notifyMatchFailure( + storeOp, "expected spirv.storage_class memory space"); + + const auto &typeConverter = *getTypeConverter(); + auto loc = storeOp.getLoc(); + Value accessChain = + spirv::getElementPtr(typeConverter, memrefType, adaptor.getBase(), + adaptor.getIndices(), loc, rewriter); + if (!accessChain) + return rewriter.notifyMatchFailure( + storeOp, "failed to get memref element pointer"); + + spirv::StorageClass storageClass = attr.getValue(); + auto vectorType = storeOp.getVectorType(); + auto vectorPtrType = spirv::PointerType::get(vectorType, storageClass); + Value castedAccessChain = + rewriter.create(loc, vectorPtrType, accessChain); + rewriter.replaceOpWithNewOp(storeOp, castedAccessChain, + adaptor.getValueToStore()); + + return success(); + } +}; + struct VectorReductionToDotProd final : OpRewritePattern { using OpRewritePattern::OpRewritePattern; @@ -614,15 +684,16 @@ struct VectorReductionToDotProd final : OpRewritePattern { void mlir::populateVectorToSPIRVPatterns(SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns) { - patterns.add, - VectorFmaOpConvert, VectorInsertElementOpConvert, - VectorInsertOpConvert, VectorReductionPattern, - VectorReductionPattern, VectorShapeCast, - VectorInsertStridedSliceOpConvert, VectorShuffleOpConvert, - VectorSplatPattern>(typeConverter, patterns.getContext()); + patterns.add< + VectorBitcastConvert, VectorBroadcastConvert, + VectorExtractElementOpConvert, VectorExtractOpConvert, + VectorExtractStridedSliceOpConvert, VectorFmaOpConvert, + VectorFmaOpConvert, VectorInsertElementOpConvert, + VectorInsertOpConvert, VectorReductionPattern, + VectorReductionPattern, VectorShapeCast, + VectorInsertStridedSliceOpConvert, VectorShuffleOpConvert, + VectorSplatPattern, VectorLoadOpConverter, VectorStoreOpConverter>( + typeConverter, patterns.getContext()); } void mlir::populateVectorReductionToSPIRVDotProductPatterns( diff --git a/mlir/test/Conversion/VectorToSPIRV/vector-to-spirv.mlir b/mlir/test/Conversion/VectorToSPIRV/vector-to-spirv.mlir index 6265a057a1b85c..75b2822a852736 100644 --- a/mlir/test/Conversion/VectorToSPIRV/vector-to-spirv.mlir +++ b/mlir/test/Conversion/VectorToSPIRV/vector-to-spirv.mlir @@ -631,3 +631,105 @@ func.func @shape_cast_size1_vector(%arg0 : vector) -> vector<1xf32> { %1 = vector.shape_cast %arg0 : vector to vector<1xf32> return %1 : vector<1xf32> } + +// ----- + +module attributes { + spirv.target_env = #spirv.target_env< + #spirv.vce, #spirv.resource_limits<>> + } { + +// CHECK-LABEL: @vector_load +// CHECK-SAME: (%[[ARG0:.*]]: memref<4xf32, #spirv.storage_class>) +// CHECK: %[[S0:.+]] = builtin.unrealized_conversion_cast %[[ARG0]] : memref<4xf32, #spirv.storage_class> to !spirv.ptr [0])>, StorageBuffer> +// CHECK: %[[C0:.+]] = arith.constant 0 : index +// CHECK: %[[S1:.+]] = builtin.unrealized_conversion_cast %[[C0]] : index to i32 +// CHECK: %[[CST1:.+]] = spirv.Constant 0 : i32 +// CHECK: %[[CST2:.+]] = spirv.Constant 0 : i32 +// CHECK: %[[CST3:.+]] = spirv.Constant 1 : i32 +// CHECK: %[[S2:.+]] = spirv.IMul %[[CST3]], %[[S1]] : i32 +// CHECK: %[[S3:.+]] = spirv.IAdd %[[CST2]], %[[S2]] : i32 +// CHECK: %[[S4:.+]] = spirv.AccessChain %[[S0]][%[[CST1]], %[[S3]]] : !spirv.ptr [0])>, StorageBuffer>, i32, i32 +// CHECK: %[[S5:.+]] = spirv.Bitcast %[[S4]] : !spirv.ptr to !spirv.ptr, StorageBuffer> +// CHECK: %[[R0:.+]] = spirv.Load "StorageBuffer" %[[S5]] : vector<4xf32> +// CHECK: return %[[R0]] : vector<4xf32> +func.func @vector_load(%arg0 : memref<4xf32, #spirv.storage_class>) -> vector<4xf32> { + %idx = arith.constant 0 : index + %cst_0 = arith.constant 0.000000e+00 : f32 + %0 = vector.load %arg0[%idx] : memref<4xf32, #spirv.storage_class>, vector<4xf32> + return %0: vector<4xf32> +} + +// CHECK-LABEL: @vector_load_2d +// CHECK-SAME: (%[[ARG0:.*]]: memref<4x4xf32, #spirv.storage_class>) -> vector<4xf32> { +// CHECK: %[[S0:.+]] = builtin.unrealized_conversion_cast %[[ARG0]] : memref<4x4xf32, #spirv.storage_class> to !spirv.ptr [0])>, StorageBuffer> +// CHECK: %[[C0:.+]] = arith.constant 0 : index +// CHECK: %[[S1:.+]] = builtin.unrealized_conversion_cast %[[C0]] : index to i32 +// CHECK: %[[C1:.+]] = arith.constant 1 : index +// CHECK: %[[S2:.+]] = builtin.unrealized_conversion_cast %[[C1]] : index to i32 +// CHECK: %[[CST0_1:.+]] = spirv.Constant 0 : i32 +// CHECK: %[[CST0_2:.+]] = spirv.Constant 0 : i32 +// CHECK: %[[CST4:.+]] = spirv.Constant 4 : i32 +// CHECK: %[[S3:.+]] = spirv.IMul %[[CST4]], %[[S1]] : i32 +// CHECK: %[[S4:.+]] = spirv.IAdd %[[CST0_2]], %[[S3]] : i32 +// CHECK: %[[CST1:.+]] = spirv.Constant 1 : i32 +// CHECK: %[[S5:.+]] = spirv.IMul %[[CST1]], %[[S2]] : i32 +// CHECK: %[[S6:.+]] = spirv.IAdd %[[S4]], %[[S5]] : i32 +// CHECK: %[[S7:.+]] = spirv.AccessChain %[[S0]][%[[CST0_1]], %[[S6]]] : !spirv.ptr [0])>, StorageBuffer>, i32, i32 +// CHECK: %[[S8:.+]] = spirv.Bitcast %[[S7]] : !spirv.ptr to !spirv.ptr, StorageBuffer> +// CHECK: %[[R0:.+]] = spirv.Load "StorageBuffer" %[[S8]] : vector<4xf32> +// CHECK: return %[[R0]] : vector<4xf32> +func.func @vector_load_2d(%arg0 : memref<4x4xf32, #spirv.storage_class>) -> vector<4xf32> { + %idx_0 = arith.constant 0 : index + %idx_1 = arith.constant 1 : index + %0 = vector.load %arg0[%idx_0, %idx_1] : memref<4x4xf32, #spirv.storage_class>, vector<4xf32> + return %0: vector<4xf32> +} + +// CHECK-LABEL: @vector_store +// CHECK-SAME: (%[[ARG0:.*]]: memref<4xf32, #spirv.storage_class> +// CHECK-SAME: %[[ARG1:.*]]: vector<4xf32> +// CHECK: %[[S0:.+]] = builtin.unrealized_conversion_cast %[[ARG0]] : memref<4xf32, #spirv.storage_class> to !spirv.ptr [0])>, StorageBuffer> +// CHECK: %[[C0:.+]] = arith.constant 0 : index +// CHECK: %[[S1:.+]] = builtin.unrealized_conversion_cast %[[C0]] : index to i32 +// CHECK: %[[CST1:.+]] = spirv.Constant 0 : i32 +// CHECK: %[[CST2:.+]] = spirv.Constant 0 : i32 +// CHECK: %[[CST3:.+]] = spirv.Constant 1 : i32 +// CHECK: %[[S2:.+]] = spirv.IMul %[[CST3]], %[[S1]] : i32 +// CHECK: %[[S3:.+]] = spirv.IAdd %[[CST2]], %[[S2]] : i32 +// CHECK: %[[S4:.+]] = spirv.AccessChain %[[S0]][%[[CST1]], %[[S3]]] : !spirv.ptr [0])>, StorageBuffer>, i32, i32 +// CHECK: %[[S5:.+]] = spirv.Bitcast %[[S4]] : !spirv.ptr to !spirv.ptr, StorageBuffer> +// CHECK: spirv.Store "StorageBuffer" %[[S5]], %[[ARG1]] : vector<4xf32> +func.func @vector_store(%arg0 : memref<4xf32, #spirv.storage_class>, %arg1 : vector<4xf32>) { + %idx = arith.constant 0 : index + vector.store %arg1, %arg0[%idx] : memref<4xf32, #spirv.storage_class>, vector<4xf32> + return +} + +// CHECK-LABEL: @vector_store_2d +// CHECK-SAME: (%[[ARG0:.*]]: memref<4x4xf32, #spirv.storage_class> +// CHECK-SAME: %[[ARG1:.*]]: vector<4xf32> +// CHECK: %[[S0:.+]] = builtin.unrealized_conversion_cast %[[ARG0]] : memref<4x4xf32, #spirv.storage_class> to !spirv.ptr [0])>, StorageBuffer> +// CHECK: %[[C0:.+]] = arith.constant 0 : index +// CHECK: %[[S1:.+]] = builtin.unrealized_conversion_cast %[[C0]] : index to i32 +// CHECK: %[[C1:.+]] = arith.constant 1 : index +// CHECK: %[[S2:.+]] = builtin.unrealized_conversion_cast %[[C1]] : index to i32 +// CHECK: %[[CST0_1:.+]] = spirv.Constant 0 : i32 +// CHECK: %[[CST0_2:.+]] = spirv.Constant 0 : i32 +// CHECK: %[[CST4:.+]] = spirv.Constant 4 : i32 +// CHECK: %[[S3:.+]] = spirv.IMul %[[CST4]], %[[S1]] : i32 +// CHECK: %[[S4:.+]] = spirv.IAdd %[[CST0_2]], %[[S3]] : i32 +// CHECK: %[[CST1:.+]] = spirv.Constant 1 : i32 +// CHECK: %[[S5:.+]] = spirv.IMul %[[CST1]], %[[S2]] : i32 +// CHECK: %[[S6:.+]] = spirv.IAdd %[[S4]], %[[S5]] : i32 +// CHECK: %[[S7:.+]] = spirv.AccessChain %[[S0]][%[[CST0_1]], %[[S6]]] : !spirv.ptr [0])>, StorageBuffer>, i32, i32 +// CHECK: %[[S8:.+]] = spirv.Bitcast %[[S7]] : !spirv.ptr to !spirv.ptr, StorageBuffer> +// CHECK: spirv.Store "StorageBuffer" %[[S8]], %[[ARG1]] : vector<4xf32> +func.func @vector_store_2d(%arg0 : memref<4x4xf32, #spirv.storage_class>, %arg1 : vector<4xf32>) { + %idx_0 = arith.constant 0 : index + %idx_1 = arith.constant 1 : index + vector.store %arg1, %arg0[%idx_0, %idx_1] : memref<4x4xf32, #spirv.storage_class>, vector<4xf32> + return +} + +} // end module From da85160e7531119ab43c069e84d5f26ab09b7e42 Mon Sep 17 00:00:00 2001 From: LLVM GN Syncbot Date: Fri, 24 Nov 2023 10:29:53 +0000 Subject: [PATCH 11/35] [gn build] Port 28233b11ac0e --- llvm/utils/gn/secondary/llvm/lib/Target/AMDGPU/BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/llvm/utils/gn/secondary/llvm/lib/Target/AMDGPU/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/Target/AMDGPU/BUILD.gn index 1afff26bca0279..6d518446fca291 100644 --- a/llvm/utils/gn/secondary/llvm/lib/Target/AMDGPU/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/lib/Target/AMDGPU/BUILD.gn @@ -148,6 +148,7 @@ static_library("LLVMAMDGPUCodeGen") { "AMDGPUISelLowering.cpp", "AMDGPUImageIntrinsicOptimizer.cpp", "AMDGPUInsertDelayAlu.cpp", + "AMDGPUInsertSingleUseVDST.cpp", "AMDGPUInstCombineIntrinsic.cpp", "AMDGPUInstrInfo.cpp", "AMDGPUInstructionSelector.cpp", From 076ec9f5f5bf03983f43f703e3f9d4600bad9653 Mon Sep 17 00:00:00 2001 From: Kadir Cetinkaya Date: Fri, 24 Nov 2023 11:38:30 +0100 Subject: [PATCH 12/35] Fix build failure on certain bots --- clang/lib/Basic/Targets/RISCV.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Basic/Targets/RISCV.cpp b/clang/lib/Basic/Targets/RISCV.cpp index 0ecc35f3a332a9..d1d9cc1c770e36 100644 --- a/clang/lib/Basic/Targets/RISCV.cpp +++ b/clang/lib/Basic/Targets/RISCV.cpp @@ -269,7 +269,7 @@ resolveTargetAttrOverride(const std::vector &FeaturesVec, std::vector NonISAExtFeature = collectNonISAExtFeature(FeaturesNeedOverride, XLen); - auto ResolvedFeature = std::vector(++I, FeaturesVec.end()); + auto ResolvedFeature = std::vector(++I, FeaturesVec.end()); ResolvedFeature.insert(ResolvedFeature.end(), NonISAExtFeature.begin(), NonISAExtFeature.end()); From c1e3a94105225a0ad6aa181ec15a9f31cf546237 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 24 Nov 2023 11:15:05 +0100 Subject: [PATCH 13/35] [TargetLowering] Don't include ComplexDeinterleavingPass.h (NFC) TargetLowering.h shouldn't include any passes and thus pull in the entire pass infrastructure. Replace the include with forward declarations. --- llvm/include/llvm/CodeGen/TargetLowering.h | 3 ++- llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | 1 + llvm/lib/Target/ARM/ARMISelLowering.cpp | 1 + llvm/lib/Target/X86/X86CallingConv.cpp | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/llvm/include/llvm/CodeGen/TargetLowering.h b/llvm/include/llvm/CodeGen/TargetLowering.h index 0136d91ef2983c..77ee6b89ed8a34 100644 --- a/llvm/include/llvm/CodeGen/TargetLowering.h +++ b/llvm/include/llvm/CodeGen/TargetLowering.h @@ -27,7 +27,6 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" -#include "llvm/CodeGen/ComplexDeinterleavingPass.h" #include "llvm/CodeGen/DAGCombine.h" #include "llvm/CodeGen/ISDOpcodes.h" #include "llvm/CodeGen/LowLevelTypeUtils.h" @@ -66,6 +65,8 @@ namespace llvm { class AssumptionCache; class CCState; class CCValAssign; +enum class ComplexDeinterleavingOperation; +enum class ComplexDeinterleavingRotation; class Constant; class FastISel; class FunctionLoweringInfo; diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp index 28e038abcecfc8..166b0d84a2ce28 100644 --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -37,6 +37,7 @@ #include "llvm/Analysis/VectorUtils.h" #include "llvm/CodeGen/Analysis.h" #include "llvm/CodeGen/CallingConvLower.h" +#include "llvm/CodeGen/ComplexDeinterleavingPass.h" #include "llvm/CodeGen/GlobalISel/GenericMachineInstrs.h" #include "llvm/CodeGen/GlobalISel/Utils.h" #include "llvm/CodeGen/ISDOpcodes.h" diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp index 308a9ea92fcd82..c8632d2aedb16f 100644 --- a/llvm/lib/Target/ARM/ARMISelLowering.cpp +++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp @@ -40,6 +40,7 @@ #include "llvm/ADT/Twine.h" #include "llvm/Analysis/VectorUtils.h" #include "llvm/CodeGen/CallingConvLower.h" +#include "llvm/CodeGen/ComplexDeinterleavingPass.h" #include "llvm/CodeGen/ISDOpcodes.h" #include "llvm/CodeGen/IntrinsicLowering.h" #include "llvm/CodeGen/MachineBasicBlock.h" diff --git a/llvm/lib/Target/X86/X86CallingConv.cpp b/llvm/lib/Target/X86/X86CallingConv.cpp index 3ff107316b9cab..0ea51bec29b816 100644 --- a/llvm/lib/Target/X86/X86CallingConv.cpp +++ b/llvm/lib/Target/X86/X86CallingConv.cpp @@ -16,6 +16,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/CodeGen/CallingConvLower.h" #include "llvm/IR/CallingConv.h" +#include "llvm/IR/Module.h" using namespace llvm; From f1d773863dc2707d96ce0f506801b363f8b079cf Mon Sep 17 00:00:00 2001 From: Akash Banerjee Date: Fri, 24 Nov 2023 11:33:19 +0000 Subject: [PATCH 14/35] [Flang][OpenMP] Remove use of non reference values from MapInfoOp (#72444) This patch removes the val field from the `MapInfoOp`. Previously when lowering `TargetOp`, the bounds information for the `BoxValues` were also being mapped. Instead these ops are now cloned inside the target region to prevent mapping of non reference typed values. --- flang/lib/Lower/OpenMP.cpp | 176 +++++++++--------- flang/test/Lower/OpenMP/FIR/array-bounds.f90 | 4 +- flang/test/Lower/OpenMP/FIR/target.f90 | 76 ++++++-- flang/test/Lower/OpenMP/array-bounds.f90 | 4 +- flang/test/Lower/OpenMP/target.f90 | 73 +++++--- mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td | 15 +- mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp | 9 - .../OpenMP/OpenMPToLLVMIRTranslation.cpp | 41 ++-- mlir/test/Dialect/OpenMP/invalid.mlir | 36 ---- .../offloading/fortran/constant-arr-index.f90 | 6 +- ...y.f90 => target-region-implicit-array.f90} | 9 +- 11 files changed, 221 insertions(+), 228 deletions(-) rename openmp/libomptarget/test/offloading/fortran/{basic-target-region-array.f90 => target-region-implicit-array.f90} (87%) diff --git a/flang/lib/Lower/OpenMP.cpp b/flang/lib/Lower/OpenMP.cpp index cc799fdc27be06..a49589d8c59ff8 100644 --- a/flang/lib/Lower/OpenMP.cpp +++ b/flang/lib/Lower/OpenMP.cpp @@ -28,6 +28,7 @@ #include "flang/Semantics/tools.h" #include "mlir/Dialect/OpenMP/OpenMPDialect.h" #include "mlir/Dialect/SCF/IR/SCF.h" +#include "mlir/Transforms/RegionUtils.h" #include "llvm/Frontend/OpenMP/OMPConstants.h" #include "llvm/Support/CommandLine.h" @@ -1711,9 +1712,9 @@ static mlir::omp::MapInfoOp createMapInfoOp(fir::FirOpBuilder &builder, mlir::Location loc, mlir::Value baseAddr, std::stringstream &name, mlir::SmallVector bounds, uint64_t mapType, - mlir::omp::VariableCaptureKind mapCaptureType, mlir::Type retTy, - bool isVal = false) { - mlir::Value val, varPtr, varPtrPtr; + mlir::omp::VariableCaptureKind mapCaptureType, + mlir::Type retTy) { + mlir::Value varPtr, varPtrPtr; mlir::TypeAttr varType; if (auto boxTy = baseAddr.getType().dyn_cast()) { @@ -1721,16 +1722,12 @@ createMapInfoOp(fir::FirOpBuilder &builder, mlir::Location loc, retTy = baseAddr.getType(); } - if (isVal) - val = baseAddr; - else - varPtr = baseAddr; - - if (auto ptrType = llvm::dyn_cast(retTy)) - varType = mlir::TypeAttr::get(ptrType.getElementType()); + varPtr = baseAddr; + varType = mlir::TypeAttr::get( + llvm::cast(retTy).getElementType()); mlir::omp::MapInfoOp op = builder.create( - loc, retTy, val, varPtr, varType, varPtrPtr, bounds, + loc, retTy, varPtr, varType, varPtrPtr, bounds, builder.getIntegerAttr(builder.getIntegerType(64, false), mapType), builder.getAttr(mapCaptureType), builder.getStringAttr(name.str())); @@ -2503,21 +2500,27 @@ static void genBodyOfTargetOp( fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder(); mlir::Region ®ion = targetOp.getRegion(); - firOpBuilder.createBlock(®ion, {}, mapSymTypes, mapSymLocs); + auto *regionBlock = + firOpBuilder.createBlock(®ion, {}, mapSymTypes, mapSymLocs); unsigned argIndex = 0; - unsigned blockArgsIndex = mapSymbols.size(); - - // The block arguments contain the map_operands followed by the bounds in - // order. This returns a vector containing the next 'n' block arguments for - // the bounds. - auto extractBoundArgs = [&](auto n) { - llvm::SmallVector argExtents; - while (n--) { - argExtents.push_back(fir::getBase(region.getArgument(blockArgsIndex))); - blockArgsIndex++; + + // Clones the `bounds` placing them inside the target region and returns them. + auto cloneBound = [&](mlir::Value bound) { + if (mlir::isMemoryEffectFree(bound.getDefiningOp())) { + mlir::Operation *clonedOp = bound.getDefiningOp()->clone(); + regionBlock->push_back(clonedOp); + return clonedOp->getResult(0); } - return argExtents; + TODO(converter.getCurrentLocation(), + "target map clause operand unsupported bound type"); + }; + + auto cloneBounds = [cloneBound](llvm::ArrayRef bounds) { + llvm::SmallVector clonedBounds; + for (mlir::Value bound : bounds) + clonedBounds.emplace_back(cloneBound(bound)); + return clonedBounds; }; // Bind the symbols to their corresponding block arguments. @@ -2526,34 +2529,31 @@ static void genBodyOfTargetOp( fir::ExtendedValue extVal = converter.getSymbolExtendedValue(*sym); extVal.match( [&](const fir::BoxValue &v) { - converter.bindSymbol( - *sym, - fir::BoxValue(arg, extractBoundArgs(v.getLBounds().size()), - v.getExplicitParameters(), v.getExplicitExtents())); + converter.bindSymbol(*sym, + fir::BoxValue(arg, cloneBounds(v.getLBounds()), + v.getExplicitParameters(), + v.getExplicitExtents())); }, [&](const fir::MutableBoxValue &v) { converter.bindSymbol( - *sym, - fir::MutableBoxValue(arg, extractBoundArgs(v.getLBounds().size()), - v.getMutableProperties())); + *sym, fir::MutableBoxValue(arg, cloneBounds(v.getLBounds()), + v.getMutableProperties())); }, [&](const fir::ArrayBoxValue &v) { converter.bindSymbol( - *sym, - fir::ArrayBoxValue(arg, extractBoundArgs(v.getExtents().size()), - extractBoundArgs(v.getLBounds().size()), - v.getSourceBox())); + *sym, fir::ArrayBoxValue(arg, cloneBounds(v.getExtents()), + cloneBounds(v.getLBounds()), + v.getSourceBox())); }, [&](const fir::CharArrayBoxValue &v) { converter.bindSymbol( - *sym, - fir::CharArrayBoxValue(arg, extractBoundArgs(1).front(), - extractBoundArgs(v.getExtents().size()), - extractBoundArgs(v.getLBounds().size()))); + *sym, fir::CharArrayBoxValue(arg, cloneBound(v.getLen()), + cloneBounds(v.getExtents()), + cloneBounds(v.getLBounds()))); }, [&](const fir::CharBoxValue &v) { - converter.bindSymbol( - *sym, fir::CharBoxValue(arg, extractBoundArgs(1).front())); + converter.bindSymbol(*sym, + fir::CharBoxValue(arg, cloneBound(v.getLen()))); }, [&](const fir::UnboxedValue &v) { converter.bindSymbol(*sym, arg); }, [&](const auto &) { @@ -2563,6 +2563,55 @@ static void genBodyOfTargetOp( argIndex++; } + // Check if cloning the bounds introduced any dependency on the outer region. + // If so, then either clone them as well if they are MemoryEffectFree, or else + // copy them to a new temporary and add them to the map and block_argument + // lists and replace their uses with the new temporary. + llvm::SetVector valuesDefinedAbove; + mlir::getUsedValuesDefinedAbove(region, valuesDefinedAbove); + while (!valuesDefinedAbove.empty()) { + for (mlir::Value val : valuesDefinedAbove) { + mlir::Operation *valOp = val.getDefiningOp(); + if (mlir::isMemoryEffectFree(valOp)) { + mlir::Operation *clonedOp = valOp->clone(); + regionBlock->push_front(clonedOp); + val.replaceUsesWithIf( + clonedOp->getResult(0), [regionBlock](mlir::OpOperand &use) { + return use.getOwner()->getBlock() == regionBlock; + }); + } else { + auto savedIP = firOpBuilder.getInsertionPoint(); + firOpBuilder.setInsertionPointAfter(valOp); + auto copyVal = + firOpBuilder.createTemporary(val.getLoc(), val.getType()); + firOpBuilder.createStoreWithConvert(copyVal.getLoc(), val, copyVal); + + llvm::SmallVector bounds; + std::stringstream name; + firOpBuilder.setInsertionPoint(targetOp); + mlir::Value mapOp = createMapInfoOp( + firOpBuilder, copyVal.getLoc(), copyVal, name, bounds, + static_cast< + std::underlying_type_t>( + llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_IMPLICIT), + mlir::omp::VariableCaptureKind::ByCopy, copyVal.getType()); + targetOp.getMapOperandsMutable().append(mapOp); + mlir::Value clonedValArg = + region.addArgument(copyVal.getType(), copyVal.getLoc()); + firOpBuilder.setInsertionPointToStart(regionBlock); + auto loadOp = firOpBuilder.create(clonedValArg.getLoc(), + clonedValArg); + val.replaceUsesWithIf( + loadOp->getResult(0), [regionBlock](mlir::OpOperand &use) { + return use.getOwner()->getBlock() == regionBlock; + }); + firOpBuilder.setInsertionPoint(regionBlock, savedIP); + } + } + valuesDefinedAbove.clear(); + mlir::getUsedValuesDefinedAbove(region, valuesDefinedAbove); + } + // Insert dummy instruction to remember the insertion position. The // marker will be deleted since there are not uses. // In the HLFIR flow there are hlfir.declares inserted above while @@ -2685,53 +2734,6 @@ genTargetOp(Fortran::lower::AbstractConverter &converter, }; Fortran::lower::pft::visitAllSymbols(eval, captureImplicitMap); - // Add the bounds and extents for box values to mapOperands - auto addMapInfoForBounds = [&](const auto &bounds) { - for (auto &val : bounds) { - mapSymLocs.push_back(val.getLoc()); - mapSymTypes.push_back(val.getType()); - - llvm::SmallVector bounds; - std::stringstream name; - - mlir::Value mapOp = createMapInfoOp( - converter.getFirOpBuilder(), val.getLoc(), val, name, bounds, - static_cast< - std::underlying_type_t>( - llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_IMPLICIT), - mlir::omp::VariableCaptureKind::ByCopy, val.getType(), true); - mapOperands.push_back(mapOp); - } - }; - - for (const Fortran::semantics::Symbol *sym : mapSymbols) { - fir::ExtendedValue extVal = converter.getSymbolExtendedValue(*sym); - extVal.match( - [&](const fir::BoxValue &v) { addMapInfoForBounds(v.getLBounds()); }, - [&](const fir::MutableBoxValue &v) { - addMapInfoForBounds(v.getLBounds()); - }, - [&](const fir::ArrayBoxValue &v) { - addMapInfoForBounds(v.getExtents()); - addMapInfoForBounds(v.getLBounds()); - }, - [&](const fir::CharArrayBoxValue &v) { - llvm::SmallVector len; - len.push_back(v.getLen()); - addMapInfoForBounds(len); - addMapInfoForBounds(v.getExtents()); - addMapInfoForBounds(v.getLBounds()); - }, - [&](const fir::CharBoxValue &v) { - llvm::SmallVector len; - len.push_back(v.getLen()); - addMapInfoForBounds(len); - }, - [&](const auto &) { - // Nothing to do for non-box values. - }); - } - auto targetOp = converter.getFirOpBuilder().create( currentLocation, ifClauseOperand, deviceOperand, threadLimitOperand, nowaitAttr, mapOperands); diff --git a/flang/test/Lower/OpenMP/FIR/array-bounds.f90 b/flang/test/Lower/OpenMP/FIR/array-bounds.f90 index 02b5ebcee02267..8acc9738821464 100644 --- a/flang/test/Lower/OpenMP/FIR/array-bounds.f90 +++ b/flang/test/Lower/OpenMP/FIR/array-bounds.f90 @@ -16,7 +16,7 @@ !ALL: %[[BOUNDS1:.*]] = omp.bounds lower_bound(%[[C5]] : index) upper_bound(%[[C6]] : index) stride(%[[C4]] : index) start_idx(%[[C4]] : index) !ALL: %[[MAP1:.*]] = omp.map_info var_ptr(%[[WRITE]] : !fir.ref>, !fir.array<10xi32>) map_clauses(tofrom) capture(ByRef) bounds(%[[BOUNDS1]]) -> !fir.ref> {name = "sp_write(2:5)"} !ALL: %[[MAP2:.*]] = omp.map_info var_ptr(%[[ITER]] : !fir.ref, i32) map_clauses(implicit, exit_release_or_enter_alloc) capture(ByCopy) -> !fir.ref {name = "i"} -!ALL: omp.target map_entries(%[[MAP0]] -> %{{.*}}, %[[MAP1]] -> %{{.*}}, %[[MAP2]] -> %{{.*}}, %{{.*}} -> %{{.*}}, %{{.*}} -> %{{.*}} : !fir.ref>, !fir.ref>, !fir.ref, index, index) { +!ALL: omp.target map_entries(%[[MAP0]] -> %{{.*}}, %[[MAP1]] -> %{{.*}}, %[[MAP2]] -> %{{.*}} : !fir.ref>, !fir.ref>, !fir.ref) { subroutine read_write_section() integer :: sp_read(10) = (/1,2,3,4,5,6,7,8,9,10/) @@ -64,7 +64,7 @@ end subroutine assumed_shape_array !ALL: %[[BOUNDS:.*]] = omp.bounds lower_bound(%[[C1]] : index) upper_bound(%[[C2]] : index) stride(%[[C0]] : index) start_idx(%[[C0]] : index) !ALL: %[[MAP:.*]] = omp.map_info var_ptr(%[[ARG0]] : !fir.ref>, !fir.array) map_clauses(tofrom) capture(ByRef) bounds(%[[BOUNDS]]) -> !fir.ref> {name = "arr_read_write(2:5)"} !ALL: %[[MAP2:.*]] = omp.map_info var_ptr(%[[ALLOCA]] : !fir.ref, i32) map_clauses(implicit, exit_release_or_enter_alloc) capture(ByCopy) -> !fir.ref {name = "i"} -!ALL: omp.target map_entries(%[[MAP]] -> %{{.*}}, %[[MAP2]] -> %{{.*}}, %{{.*}} -> %{{.*}} : !fir.ref>, !fir.ref, index) { +!ALL: omp.target map_entries(%[[MAP]] -> %{{.*}}, %[[MAP2]] -> %{{.*}} : !fir.ref>, !fir.ref) { subroutine assumed_size_array(arr_read_write) integer, intent(inout) :: arr_read_write(*) diff --git a/flang/test/Lower/OpenMP/FIR/target.f90 b/flang/test/Lower/OpenMP/FIR/target.f90 index cf3b6fff0cb749..2034ac84334e54 100644 --- a/flang/test/Lower/OpenMP/FIR/target.f90 +++ b/flang/test/Lower/OpenMP/FIR/target.f90 @@ -189,8 +189,8 @@ subroutine omp_target integer :: a(1024) !CHECK: %[[BOUNDS:.*]] = omp.bounds lower_bound({{.*}}) upper_bound({{.*}}) extent({{.*}}) stride({{.*}}) start_idx({{.*}}) !CHECK: %[[MAP:.*]] = omp.map_info var_ptr(%[[VAL_0]] : !fir.ref>, !fir.array<1024xi32>) map_clauses(tofrom) capture(ByRef) bounds(%[[BOUNDS]]) -> !fir.ref> {name = "a"} - !CHECK: omp.target map_entries(%[[MAP]] -> %[[ARG_0:.*]], %{{.*}} -> %{{.*}} : !fir.ref>, index) { - !CHECK: ^bb0(%[[ARG_0]]: !fir.ref>, %{{.*}}: index): + !CHECK: omp.target map_entries(%[[MAP]] -> %[[ARG_0:.*]] : !fir.ref>) { + !CHECK: ^bb0(%[[ARG_0]]: !fir.ref>): !$omp target map(tofrom: a) !CHECK: %[[VAL_1:.*]] = arith.constant 10 : i32 !CHECK: %[[VAL_2:.*]] = arith.constant 1 : i64 @@ -213,8 +213,8 @@ subroutine omp_target_implicit !CHECK: %[[VAL_0:.*]] = fir.alloca !fir.array<1024xi32> {bindc_name = "a", uniq_name = "_QFomp_target_implicitEa"} integer :: a(1024) !CHECK: %[[MAP:.*]] = omp.map_info var_ptr(%[[VAL_0]] : !fir.ref>, !fir.array<1024xi32>) map_clauses(implicit, tofrom) capture(ByRef) bounds(%{{.*}}) -> !fir.ref> {name = "a"} - !CHECK: omp.target map_entries(%[[MAP]] -> %[[ARG_0:.*]], %{{.*}} -> %{{.*}} : !fir.ref>, index) { - !CHECK: ^bb0(%[[ARG_0]]: !fir.ref>, %{{.*}}: index): + !CHECK: omp.target map_entries(%[[MAP]] -> %[[ARG_0:.*]] : !fir.ref>) { + !CHECK: ^bb0(%[[ARG_0]]: !fir.ref>): !$omp target !CHECK: %[[VAL_5:.*]] = fir.coordinate_of %[[ARG_0]], %{{.*}} : (!fir.ref>, i64) -> !fir.ref a(1) = 10 @@ -249,22 +249,62 @@ end subroutine omp_target_implicit_nested ! Target implicit capture with bounds !=============================================================================== -!CHECK-LABEL: func.func @_QPomp_target_implicit_bounds(%{{.*}}: !fir.ref {fir.bindc_name = "n"}) { + +!CHECK-LABEL: func.func @_QPomp_target_implicit_bounds( +!CHECK: %[[VAL_0:.*]]: !fir.ref {fir.bindc_name = "n"}) { subroutine omp_target_implicit_bounds(n) - !CHECK: %[[VAL_1:.*]] = arith.select %{{.*}}, %{{.*}}, %{{.*}} : index - !CHECK: %[[VAL_2:.*]] = arith.select %{{.*}}, %{{.*}}, %{{.*}} : index - !CHECK: %[[VAL_3:.*]] = fir.alloca !fir.array, %[[VAL_1]] {bindc_name = "a", uniq_name = "_QFomp_target_implicit_boundsEa"} + !CHECK: %[[VAL_COPY:.*]] = fir.alloca i32 + !CHECK: %[[VAL_1:.*]] = fir.load %[[VAL_0]] : !fir.ref + !CHECK: fir.store %[[VAL_1]] to %[[VAL_COPY]] : !fir.ref + !CHECK: %[[VAL_2:.*]] = fir.convert %[[VAL_1]] : (i32) -> i64 + !CHECK: %[[VAL_3:.*]] = fir.convert %[[VAL_2]] : (i64) -> index + !CHECK: %[[VAL_4:.*]] = arith.constant 0 : index + !CHECK: %[[VAL_5:.*]] = arith.cmpi sgt, %[[VAL_3]], %[[VAL_4]] : index + !CHECK: %[[VAL_6:.*]] = arith.select %[[VAL_5]], %[[VAL_3]], %[[VAL_4]] : index + !CHECK: %[[VAL_7:.*]] = arith.constant 1024 : i64 + !CHECK: %[[VAL_8:.*]] = fir.convert %[[VAL_7]] : (i64) -> index + !CHECK: %[[VAL_9:.*]] = arith.constant 0 : index + !CHECK: %[[VAL_10:.*]] = arith.cmpi sgt, %[[VAL_8]], %[[VAL_9]] : index + !CHECK: %[[VAL_11:.*]] = arith.select %[[VAL_10]], %[[VAL_8]], %[[VAL_9]] : index + !CHECK: %[[VAL_12:.*]] = fir.alloca !fir.array, %[[VAL_6]] {bindc_name = "a", uniq_name = "_QFomp_target_implicit_boundsEa"} integer :: n integer :: a(n, 1024) - !CHECK: %[[VAL_4:.*]] = omp.map_info var_ptr(%[[VAL_3]] : !fir.ref>, !fir.array) map_clauses(implicit, tofrom) capture(ByRef) bounds(%{{.*}}) -> !fir.ref> {name = "a"} - !CHECK: %[[VAL_5:.*]] = omp.map_info val(%[[VAL_1]] : index) map_clauses(implicit, exit_release_or_enter_alloc) capture(ByCopy) -> index {name = ""} - !CHECK: %[[VAL_6:.*]] = omp.map_info val(%[[VAL_2]] : index) map_clauses(implicit, exit_release_or_enter_alloc) capture(ByCopy) -> index {name = ""} - !CHECK: omp.target map_entries(%[[VAL_4]] -> %[[ARG_1:.*]], %[[VAL_5]] -> %[[ARG_2:.*]], %[[VAL_6]] -> %[[ARG_3:.*]] : !fir.ref>, index, index) { - !CHECK: ^bb0(%[[ARG_1]]: !fir.ref>, %[[ARG_2]]: index, %[[ARG_3]]: index): + !CHECK: %[[VAL_13:.*]] = arith.constant 1 : index + !CHECK: %[[VAL_14:.*]] = arith.constant 0 : index + !CHECK: %[[VAL_15:.*]] = arith.subi %[[VAL_6]], %[[VAL_13]] : index + !CHECK: %[[VAL_16:.*]] = omp.bounds lower_bound(%[[VAL_14]] : index) upper_bound(%[[VAL_15]] : index) extent(%[[VAL_6]] : index) stride(%[[VAL_13]] : index) start_idx(%[[VAL_13]] : index) + !CHECK: %[[VAL_17:.*]] = arith.constant 0 : index + !CHECK: %[[VAL_18:.*]] = arith.subi %[[VAL_11]], %[[VAL_13]] : index + !CHECK: %[[VAL_19:.*]] = omp.bounds lower_bound(%[[VAL_17]] : index) upper_bound(%[[VAL_18]] : index) extent(%[[VAL_11]] : index) stride(%[[VAL_13]] : index) start_idx(%[[VAL_13]] : index) + !CHECK: %[[VAL_20:.*]] = omp.map_info var_ptr(%[[VAL_12]] : !fir.ref>, !fir.array) map_clauses(implicit, tofrom) capture(ByRef) bounds(%[[VAL_16]], %[[VAL_19]]) -> !fir.ref> {name = "a"} + !CHECK: %[[VAL_21:.*]] = omp.map_info var_ptr(%[[VAL_COPY]] : !fir.ref, i32) map_clauses(implicit, exit_release_or_enter_alloc) capture(ByCopy) -> !fir.ref {name = ""} + !CHECK: omp.target map_entries(%[[VAL_20]] -> %[[VAL_22:.*]], %[[VAL_21]] -> %[[VAL_23:.*]] : !fir.ref>, !fir.ref) { + !CHECK: ^bb0(%[[VAL_22]]: !fir.ref>, %[[VAL_23]]: !fir.ref): !$omp target - !CHECK: %{{.*}} = fir.convert %[[ARG_1]] : (!fir.ref>) -> !fir.ref> - !CHECK: %{{.*}} = arith.muli %{{.*}}, %[[ARG_2]] : index - a(11,22) = 33 + !CHECK: %[[VAL_24:.*]] = fir.load %[[VAL_23]] : !fir.ref + !CHECK: %[[VAL_25:.*]] = fir.convert %[[VAL_24]] : (i32) -> i64 + !CHECK: %[[VAL_26:.*]] = arith.constant 0 : index + !CHECK: %[[VAL_27:.*]] = fir.convert %[[VAL_25]] : (i64) -> index + !CHECK: %[[VAL_28:.*]] = arith.cmpi sgt, %[[VAL_27]], %[[VAL_26]] : index + !CHECK: %[[VAL_29:.*]] = arith.select %[[VAL_28]], %[[VAL_27]], %[[VAL_26]] : index + !CHECK: %[[VAL_30:.*]] = arith.constant 33 : i32 + !CHECK: %[[VAL_31:.*]] = fir.convert %[[VAL_22]] : (!fir.ref>) -> !fir.ref> + !CHECK: %[[VAL_32:.*]] = arith.constant 1 : index + !CHECK: %[[VAL_33:.*]] = arith.constant 0 : index + !CHECK: %[[VAL_34:.*]] = arith.constant 11 : i64 + !CHECK: %[[VAL_35:.*]] = fir.convert %[[VAL_34]] : (i64) -> index + !CHECK: %[[VAL_36:.*]] = arith.subi %[[VAL_35]], %[[VAL_32]] : index + !CHECK: %[[VAL_37:.*]] = arith.muli %[[VAL_32]], %[[VAL_36]] : index + !CHECK: %[[VAL_38:.*]] = arith.addi %[[VAL_37]], %[[VAL_33]] : index + !CHECK: %[[VAL_39:.*]] = arith.muli %[[VAL_32]], %[[VAL_29]] : index + !CHECK: %[[VAL_40:.*]] = arith.constant 22 : i64 + !CHECK: %[[VAL_41:.*]] = fir.convert %[[VAL_40]] : (i64) -> index + !CHECK: %[[VAL_42:.*]] = arith.subi %[[VAL_41]], %[[VAL_32]] : index + !CHECK: %[[VAL_43:.*]] = arith.muli %[[VAL_39]], %[[VAL_42]] : index + !CHECK: %[[VAL_44:.*]] = arith.addi %[[VAL_43]], %[[VAL_38]] : index + !CHECK: %[[VAL_45:.*]] = fir.coordinate_of %[[VAL_31]], %[[VAL_44]] : (!fir.ref>, index) -> !fir.ref + !CHECK: fir.store %[[VAL_30]] to %[[VAL_45]] : !fir.ref + a(11, 22) = 33 !CHECK: omp.terminator !$omp end target !CHECK: } @@ -344,8 +384,8 @@ subroutine omp_target_parallel_do !CHECK: %[[BOUNDS:.*]] = omp.bounds lower_bound(%[[C0]] : index) upper_bound(%[[SUB]] : index) extent(%[[C1024]] : index) stride(%[[C1]] : index) start_idx(%[[C1]] : index) !CHECK: %[[MAP1:.*]] = omp.map_info var_ptr(%[[VAL_0]] : !fir.ref>, !fir.array<1024xi32>) map_clauses(tofrom) capture(ByRef) bounds(%[[BOUNDS]]) -> !fir.ref> {name = "a"} !CHECK: %[[MAP2:.*]] = omp.map_info var_ptr(%[[VAL_1]] : !fir.ref, i32) map_clauses(implicit, exit_release_or_enter_alloc) capture(ByCopy) -> !fir.ref {name = "i"} - !CHECK: omp.target map_entries(%[[MAP1]] -> %[[VAL_2:.*]], %[[MAP2]] -> %[[VAL_3:.*]], %{{.*}} -> %{{.*}} : !fir.ref>, !fir.ref, index) { - !CHECK: ^bb0(%[[VAL_2]]: !fir.ref>, %[[VAL_3]]: !fir.ref, %{{.*}}: index): + !CHECK: omp.target map_entries(%[[MAP1]] -> %[[VAL_2:.*]], %[[MAP2]] -> %[[VAL_3:.*]] : !fir.ref>, !fir.ref) { + !CHECK: ^bb0(%[[VAL_2]]: !fir.ref>, %[[VAL_3]]: !fir.ref): !CHECK-NEXT: omp.parallel !$omp target parallel do map(tofrom: a) !CHECK: %[[VAL_4:.*]] = fir.alloca i32 {adapt.valuebyref, pinned} diff --git a/flang/test/Lower/OpenMP/array-bounds.f90 b/flang/test/Lower/OpenMP/array-bounds.f90 index d0c584bec6044a..c0e50acb8e37c4 100644 --- a/flang/test/Lower/OpenMP/array-bounds.f90 +++ b/flang/test/Lower/OpenMP/array-bounds.f90 @@ -22,7 +22,7 @@ !HOST: %[[C6:.*]] = arith.constant 4 : index !HOST: %[[BOUNDS1:.*]] = omp.bounds lower_bound(%[[C5]] : index) upper_bound(%[[C6]] : index) stride(%[[C4]] : index) start_idx(%[[C4]] : index) !HOST: %[[MAP1:.*]] = omp.map_info var_ptr(%[[WRITE_DECL]]#1 : !fir.ref>, !fir.array<10xi32>) map_clauses(tofrom) capture(ByRef) bounds(%[[BOUNDS1]]) -> !fir.ref> {name = "sp_write(2:5)"} -!HOST: omp.target map_entries(%[[MAP0]] -> %{{.*}}, %[[MAP1]] -> %{{.*}}, {{.*}} -> {{.*}}, {{.*}} -> {{.*}}, {{.*}} -> {{.*}} : !fir.ref>, !fir.ref>, !fir.ref, index, index) { +!HOST: omp.target map_entries(%[[MAP0]] -> %{{.*}}, %[[MAP1]] -> %{{.*}}, {{.*}} -> {{.*}} : !fir.ref>, !fir.ref>, !fir.ref) { subroutine read_write_section() integer :: sp_read(10) = (/1,2,3,4,5,6,7,8,9,10/) @@ -73,7 +73,7 @@ end subroutine assumed_shape_array !HOST: %[[C2:.*]] = arith.constant 4 : index !HOST: %[[BOUNDS:.*]] = omp.bounds lower_bound(%[[C1]] : index) upper_bound(%[[C2]] : index) stride(%[[C0]] : index) start_idx(%[[C0]] : index) !HOST: %[[MAP:.*]] = omp.map_info var_ptr(%[[ARG0_DECL]]#1 : !fir.ref>, !fir.array) map_clauses(tofrom) capture(ByRef) bounds(%[[BOUNDS]]) -> !fir.ref> {name = "arr_read_write(2:5)"} -!HOST: omp.target map_entries(%[[MAP]] -> %{{.*}}, {{.*}} -> {{.*}}, {{.*}} -> {{.*}} : !fir.ref>, !fir.ref, index) { +!HOST: omp.target map_entries(%[[MAP]] -> %{{.*}}, {{.*}} -> {{.*}} : !fir.ref>, !fir.ref) { subroutine assumed_size_array(arr_read_write) integer, intent(inout) :: arr_read_write(*) diff --git a/flang/test/Lower/OpenMP/target.f90 b/flang/test/Lower/OpenMP/target.f90 index 86f456b847df90..26b4d595d52291 100644 --- a/flang/test/Lower/OpenMP/target.f90 +++ b/flang/test/Lower/OpenMP/target.f90 @@ -191,10 +191,11 @@ subroutine omp_target integer :: a(1024) !CHECK: %[[BOUNDS:.*]] = omp.bounds lower_bound({{.*}}) upper_bound({{.*}}) extent({{.*}}) stride({{.*}}) start_idx({{.*}}) !CHECK: %[[MAP:.*]] = omp.map_info var_ptr(%[[VAL_1]]#1 : !fir.ref>, !fir.array<1024xi32>) map_clauses(tofrom) capture(ByRef) bounds(%[[BOUNDS]]) -> !fir.ref> {name = "a"} - !CHECK: omp.target map_entries(%[[MAP]] -> %[[ARG_0:.*]], %{{.*}} -> %[[ARG_1:.*]] : !fir.ref>, index) { - !CHECK: ^bb0(%[[ARG_0]]: !fir.ref>, %[[ARG_1]]: index): + !CHECK: omp.target map_entries(%[[MAP]] -> %[[ARG_0:.*]] : !fir.ref>) { + !CHECK: ^bb0(%[[ARG_0]]: !fir.ref>): !$omp target map(tofrom: a) - !CHECK: %[[VAL_2:.*]] = fir.shape %[[ARG_1]] : (index) -> !fir.shape<1> + !CHECK: %[[VAL_7:.*]] = arith.constant 1024 : index + !CHECK: %[[VAL_2:.*]] = fir.shape %[[VAL_7]] : (index) -> !fir.shape<1> !CHECK: %[[VAL_3:.*]]:2 = hlfir.declare %[[ARG_0]](%[[VAL_2]]) {uniq_name = "_QFomp_targetEa"} : (!fir.ref>, !fir.shape<1>) -> (!fir.ref>, !fir.ref>) !CHECK: %[[VAL_4:.*]] = arith.constant 10 : i32 !CHECK: %[[VAL_5:.*]] = arith.constant 1 : index @@ -218,10 +219,10 @@ subroutine omp_target_implicit !CHECK: %[[VAL_3:.*]]:2 = hlfir.declare %[[VAL_1]](%[[VAL_2]]) {uniq_name = "_QFomp_target_implicitEa"} : (!fir.ref>, !fir.shape<1>) -> (!fir.ref>, !fir.ref>) integer :: a(1024) !CHECK: %[[VAL_4:.*]] = omp.map_info var_ptr(%[[VAL_3]]#1 : !fir.ref>, !fir.array<1024xi32>) map_clauses(implicit, tofrom) capture(ByRef) bounds(%{{.*}}) -> !fir.ref> {name = "a"} - !CHECK: %[[VAL_5:.*]] = omp.map_info val(%[[VAL_0]] : index) map_clauses(implicit, exit_release_or_enter_alloc) capture(ByCopy) -> index {name = ""} - !CHECK: omp.target map_entries(%[[VAL_4]] -> %[[VAL_6:.*]], %[[VAL_5]] -> %[[VAL_7:.*]] : !fir.ref>, index) { - !CHECK: ^bb0(%[[VAL_6]]: !fir.ref>, %[[VAL_7]]: index): + !CHECK: omp.target map_entries(%[[VAL_4]] -> %[[VAL_6:.*]] : !fir.ref>) { + !CHECK: ^bb0(%[[VAL_6]]: !fir.ref>): !$omp target + !CHECK: %[[VAL_7:.*]] = arith.constant 1024 : index !CHECK: %[[VAL_8:.*]] = fir.shape %[[VAL_7]] : (index) -> !fir.shape<1> !CHECK: %[[VAL_9:.*]]:2 = hlfir.declare %[[VAL_6]](%[[VAL_8]]) {uniq_name = "_QFomp_target_implicitEa"} : (!fir.ref>, !fir.shape<1>) -> (!fir.ref>, !fir.ref>) !CHECK: %[[VAL_10:.*]] = arith.constant 10 : i32 @@ -265,29 +266,45 @@ end subroutine omp_target_implicit_nested ! Target implicit capture with bounds !=============================================================================== -!CHECK-LABEL: func.func @_QPomp_target_implicit_bounds(%{{.*}}: !fir.ref {fir.bindc_name = "n"}) { +!CHECK-LABEL: func.func @_QPomp_target_implicit_bounds( +!CHECK: %[[VAL_0:.*]]: !fir.ref {fir.bindc_name = "n"}) { subroutine omp_target_implicit_bounds(n) - !CHECK: %[[VAL_1:.*]] = arith.select %{{.*}}, %{{.*}}, %{{.*}} : index - !CHECK: %[[VAL_2:.*]] = arith.select %{{.*}}, %{{.*}}, %{{.*}} : index - !CHECK: %[[VAL_3:.*]] = fir.alloca !fir.array, %[[VAL_1]] {bindc_name = "a", uniq_name = "_QFomp_target_implicit_boundsEa"} - !CHECK: %[[VAL_4:.*]] = fir.shape %[[VAL_1]], %[[VAL_2]] : (index, index) -> !fir.shape<2> - !CHECK: %[[VAL_5:.*]]:2 = hlfir.declare %[[VAL_3]](%[[VAL_4]]) {uniq_name = "_QFomp_target_implicit_boundsEa"} : (!fir.ref>, !fir.shape<2>) -> (!fir.box>, !fir.ref>) + !CHECK: %[[VAL_COPY:.*]] = fir.alloca i32 + !CHECK: %[[VAL_1:.*]]:2 = hlfir.declare %[[VAL_0]] {uniq_name = "_QFomp_target_implicit_boundsEn"} : (!fir.ref) -> (!fir.ref, !fir.ref) + !CHECK: %[[VAL_2:.*]] = fir.load %[[VAL_1]]#0 : !fir.ref + !CHECK: fir.store %[[VAL_2]] to %[[VAL_COPY]] : !fir.ref + !CHECK: %[[VAL_3:.*]] = fir.convert %[[VAL_2]] : (i32) -> i64 + !CHECK: %[[VAL_4:.*]] = fir.convert %[[VAL_3]] : (i64) -> index + !CHECK: %[[VAL_5:.*]] = arith.constant 0 : index + !CHECK: %[[VAL_6:.*]] = arith.cmpi sgt, %[[VAL_4]], %[[VAL_5]] : index + !CHECK: %[[VAL_7:.*]] = arith.select %[[VAL_6]], %[[VAL_4]], %[[VAL_5]] : index + !CHECK: %[[VAL_8:.*]] = fir.alloca !fir.array, %[[VAL_7]] {bindc_name = "a", uniq_name = "_QFomp_target_implicit_boundsEa"} + !CHECK: %[[VAL_9:.*]] = fir.shape %[[VAL_7]] : (index) -> !fir.shape<1> + !CHECK: %[[VAL_10:.*]]:2 = hlfir.declare %[[VAL_8]](%[[VAL_9]]) {uniq_name = "_QFomp_target_implicit_boundsEa"} : (!fir.ref>, !fir.shape<1>) -> (!fir.box>, !fir.ref>) + !CHECK: %[[VAL_11:.*]] = arith.constant 1 : index + !CHECK: %[[VAL_12:.*]] = arith.constant 0 : index + !CHECK: %[[VAL_13:.*]] = arith.subi %[[VAL_7]], %[[VAL_11]] : index integer :: n - integer :: a(n, 1024) - !CHECK: %[[VAL_6:.*]] = omp.map_info var_ptr(%[[VAL_5]]#1 : !fir.ref>, !fir.array) map_clauses(implicit, tofrom) capture(ByRef) bounds(%{{.*}}) -> !fir.ref> {name = "a"} - !CHECK: %[[VAL_7:.*]] = omp.map_info val(%[[VAL_1]] : index) map_clauses(implicit, exit_release_or_enter_alloc) capture(ByCopy) -> index {name = ""} - !CHECK: %[[VAL_8:.*]] = omp.map_info val(%[[VAL_2]] : index) map_clauses(implicit, exit_release_or_enter_alloc) capture(ByCopy) -> index {name = ""} - !CHECK: omp.target map_entries(%[[VAL_6]] -> %[[ARG_1:.*]], %[[VAL_7]] -> %[[ARG_2:.*]], %[[VAL_8]] -> %[[ARG_3:.*]] : !fir.ref>, index, index) { - !CHECK: ^bb0(%[[ARG_1]]: !fir.ref>, %[[ARG_2]]: index, %[[ARG_3]]: index): + integer :: a(n) + !CHECK: %[[VAL_14:.*]] = omp.bounds lower_bound(%[[VAL_12]] : index) upper_bound(%[[VAL_13]] : index) extent(%[[VAL_7]] : index) stride(%[[VAL_11]] : index) start_idx(%[[VAL_11]] : index) + !CHECK: %[[VAL_15:.*]] = omp.map_info var_ptr(%[[VAL_10]]#1 : !fir.ref>, !fir.array) map_clauses(implicit, tofrom) capture(ByRef) bounds(%[[VAL_14]]) -> !fir.ref> {name = "a"} + !CHECK: %[[VAL_16:.*]] = omp.map_info var_ptr(%[[VAL_COPY]] : !fir.ref, i32) map_clauses(implicit, exit_release_or_enter_alloc) capture(ByCopy) -> !fir.ref {name = ""} + !CHECK: omp.target map_entries(%[[VAL_15]] -> %[[VAL_17:.*]], %[[VAL_16]] -> %[[VAL_18:.*]] : !fir.ref>, !fir.ref) { + !CHECK: ^bb0(%[[VAL_17]]: !fir.ref>, %[[VAL_18]]: !fir.ref): !$omp target - !CHECK: %[[VAL_9:.*]] = fir.shape %[[ARG_2]], %[[ARG_3]] : (index, index) -> !fir.shape<2> - !CHECK: %[[VAL_10:.*]]:2 = hlfir.declare %[[ARG_1]](%[[VAL_9]]) {uniq_name = "_QFomp_target_implicit_boundsEa"} : (!fir.ref>, !fir.shape<2>) -> (!fir.box>, !fir.ref>) - !CHECK: %[[VAL_11:.*]] = arith.constant 33 : i32 - !CHECK: %[[VAL_12:.*]] = arith.constant 11 : index - !CHECK: %[[VAL_13:.*]] = arith.constant 22 : index - !CHECK: %[[VAL_14:.*]] = hlfir.designate %[[VAL_10]]#0 (%[[VAL_12]], %[[VAL_13]]) : (!fir.box>, index, index) -> !fir.ref - !CHECK: hlfir.assign %[[VAL_11]] to %[[VAL_14]] : i32, !fir.ref - a(11, 22) = 33 + !CHECK: %[[VAL_19:.*]] = fir.load %[[VAL_18]] : !fir.ref + !CHECK: %[[VAL_20:.*]] = fir.convert %[[VAL_19]] : (i32) -> i64 + !CHECK: %[[VAL_21:.*]] = arith.constant 0 : index + !CHECK: %[[VAL_22:.*]] = fir.convert %[[VAL_20]] : (i64) -> index + !CHECK: %[[VAL_23:.*]] = arith.cmpi sgt, %[[VAL_22]], %[[VAL_21]] : index + !CHECK: %[[VAL_24:.*]] = arith.select %[[VAL_23]], %[[VAL_22]], %[[VAL_21]] : index + !CHECK: %[[VAL_25:.*]] = fir.shape %[[VAL_24]] : (index) -> !fir.shape<1> + !CHECK: %[[VAL_26:.*]]:2 = hlfir.declare %[[VAL_17]](%[[VAL_25]]) {uniq_name = "_QFomp_target_implicit_boundsEa"} : (!fir.ref>, !fir.shape<1>) -> (!fir.box>, !fir.ref>) + !CHECK: %[[VAL_27:.*]] = arith.constant 22 : i32 + !CHECK: %[[VAL_28:.*]] = arith.constant 11 : index + !CHECK: %[[VAL_29:.*]] = hlfir.designate %[[VAL_26]]#0 (%[[VAL_28]]) : (!fir.box>, index) -> !fir.ref + !CHECK: hlfir.assign %[[VAL_27]] to %[[VAL_29]] : i32, !fir.ref + a(11) = 22 !CHECK: omp.terminator !$omp end target !CHECK: } @@ -396,8 +413,8 @@ subroutine omp_target_parallel_do !CHECK: %[[SUB:.*]] = arith.subi %[[C1024]], %[[C1]] : index !CHECK: %[[BOUNDS:.*]] = omp.bounds lower_bound(%[[C0]] : index) upper_bound(%[[SUB]] : index) extent(%[[C1024]] : index) stride(%[[C1]] : index) start_idx(%[[C1]] : index) !CHECK: %[[MAP:.*]] = omp.map_info var_ptr(%[[VAL_0_DECL]]#1 : !fir.ref>, !fir.array<1024xi32>) map_clauses(tofrom) capture(ByRef) bounds(%[[BOUNDS]]) -> !fir.ref> {name = "a"} - !CHECK: omp.target map_entries(%[[MAP]] -> %[[ARG_0:.*]], %{{.*}} -> %{{.*}}, %{{.*}} -> %{{.*}} : !fir.ref>, !fir.ref, index) { - !CHECK: ^bb0(%[[ARG_0]]: !fir.ref>, %{{.*}}: !fir.ref, %{{.*}}: index): + !CHECK: omp.target map_entries(%[[MAP]] -> %[[ARG_0:.*]], %{{.*}} -> %{{.*}} : !fir.ref>, !fir.ref) { + !CHECK: ^bb0(%[[ARG_0]]: !fir.ref>, %{{.*}}: !fir.ref): !CHECK: %[[VAL_0_DECL:.*]]:2 = hlfir.declare %[[ARG_0]](%{{.*}}) {uniq_name = "_QFomp_target_parallel_doEa"} : (!fir.ref>, !fir.shape<1>) -> (!fir.ref>, !fir.ref>) !CHECK: omp.parallel !$omp target parallel do map(tofrom: a) diff --git a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td index bfb58b98884c72..8ff5380f71ad45 100644 --- a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td +++ b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td @@ -1145,15 +1145,14 @@ def DataBoundsOp : OpenMP_Op<"bounds", } def MapInfoOp : OpenMP_Op<"map_info", [AttrSizedOperandSegments]> { - let arguments = (ins Optional:$val, - Optional:$var_ptr, - OptionalAttr:$var_type, + let arguments = (ins OpenMP_PointerLikeType:$var_ptr, + TypeAttr:$var_type, Optional:$var_ptr_ptr, Variadic:$bounds, /* rank-0 to rank-{n-1} */ OptionalAttr:$map_type, OptionalAttr:$map_capture_type, OptionalAttr:$name); - let results = (outs AnyType:$omp_ptr); + let results = (outs OpenMP_PointerLikeType:$omp_ptr); let description = [{ The MapInfoOp captures information relating to individual OpenMP map clauses @@ -1184,9 +1183,8 @@ def MapInfoOp : OpenMP_Op<"map_info", [AttrSizedOperandSegments]> { ``` Description of arguments: - - `val`: The value to copy. - `var_ptr`: The address of variable to copy. - - `var_type`: The type of the variable/value to copy. + - `var_type`: The type of the variable to copy. - `var_ptr_ptr`: Used when the variable copied is a member of a class, structure or derived type and refers to the originating struct. - `bounds`: Used when copying slices of array's, pointers or pointer members of @@ -1202,10 +1200,9 @@ def MapInfoOp : OpenMP_Op<"map_info", [AttrSizedOperandSegments]> { }]; let assemblyFormat = [{ + `var_ptr` `(` $var_ptr `:` type($var_ptr) `,` $var_type `)` oilist( - `val` `(` $val `:` type($val) `)` - | `var_ptr` `(` $var_ptr `:` type($var_ptr) `,` $var_type `)` - | `var_ptr_ptr` `(` $var_ptr_ptr `:` type($var_ptr_ptr) `)` + `var_ptr_ptr` `(` $var_ptr_ptr `:` type($var_ptr_ptr) `)` | `map_clauses` `(` custom($map_type) `)` | `capture` `(` custom($map_capture_type) `)` | `bounds` `(` $bounds `)` diff --git a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp index 480af0e1307c15..20df0099cbd24d 100644 --- a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp +++ b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp @@ -890,15 +890,6 @@ static LogicalResult verifyMapClause(Operation *op, OperandRange mapOperands) { if (auto MapInfoOp = mlir::dyn_cast(mapOp.getDefiningOp())) { - if (MapInfoOp.getVal() && MapInfoOp.getVarPtr()) - emitError(op->getLoc(), "only one of val or var_ptr must be used"); - - if (!MapInfoOp.getVal() && !MapInfoOp.getVarPtr()) - emitError(op->getLoc(), "missing val or var_ptr"); - - if (!MapInfoOp.getVarPtr() && MapInfoOp.getVarType().has_value()) - emitError(op->getLoc(), "var_type supplied without var_ptr"); - if (!MapInfoOp.getMapType().has_value()) emitError(op->getLoc(), "missing map type for map operand"); diff --git a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp index b1305201166a03..a310d38b26cb12 100644 --- a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp +++ b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp @@ -1733,13 +1733,13 @@ void collectMapDataFromMapOperands(MapInfoData &mapData, "missing map info operation or incorrect map info operation type"); if (auto mapOp = mlir::dyn_cast_if_present( mapValue.getDefiningOp())) { - mapData.OriginalValue.push_back(moduleTranslation.lookupValue( - mapOp.getVarPtr() ? mapOp.getVarPtr() : mapOp.getVal())); + mapData.OriginalValue.push_back( + moduleTranslation.lookupValue(mapOp.getVarPtr())); mapData.Pointers.push_back(mapData.OriginalValue.back()); - if (llvm::Value *refPtr = getRefPtrIfDeclareTarget( - mapOp.getVarPtr() ? mapOp.getVarPtr() : mapOp.getVal(), - moduleTranslation)) { // declare target + if (llvm::Value *refPtr = + getRefPtrIfDeclareTarget(mapOp.getVarPtr(), + moduleTranslation)) { // declare target mapData.IsDeclareTarget.push_back(true); mapData.BasePointers.push_back(refPtr); } else { // regular mapped variable @@ -1747,14 +1747,10 @@ void collectMapDataFromMapOperands(MapInfoData &mapData, mapData.BasePointers.push_back(mapData.OriginalValue.back()); } - mapData.Sizes.push_back( - getSizeInBytes(dl, - mapOp.getVal() ? mapOp.getVal().getType() - : mapOp.getVarType().value(), - mapOp, builder, moduleTranslation)); - mapData.BaseType.push_back(moduleTranslation.convertType( - mapOp.getVal() ? mapOp.getVal().getType() - : mapOp.getVarType().value())); + mapData.Sizes.push_back(getSizeInBytes(dl, mapOp.getVarType(), mapOp, + builder, moduleTranslation)); + mapData.BaseType.push_back( + moduleTranslation.convertType(mapOp.getVarType())); mapData.MapClause.push_back(mapOp.getOperation()); mapData.Types.push_back( llvm::omp::OpenMPOffloadMappingFlags(mapOp.getMapType().value())); @@ -1804,8 +1800,7 @@ static void genMapInfos(llvm::IRBuilderBase &builder, if (auto mapInfoOp = dyn_cast(mapData.MapClause[i])) if (mapInfoOp.getMapCaptureType().value() == mlir::omp::VariableCaptureKind::ByCopy && - !(mapInfoOp.getVarType().has_value() && - mapInfoOp.getVarType()->isa())) + !mapInfoOp.getVarType().isa()) mapFlag |= llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_LITERAL; combinedInfo.BasePointers.emplace_back(mapData.BasePointers[i]); @@ -2337,19 +2332,7 @@ convertOmpTarget(Operation &opInst, llvm::IRBuilderBase &builder, DataLayout dl = DataLayout(opInst.getParentOfType()); SmallVector mapOperands = targetOp.getMapOperands(); - // Remove mapOperands/blockArgs that have no use inside the region. - assert(mapOperands.size() == targetRegion.getNumArguments() && - "Number of mapOperands must be same as block_arguments"); - for (size_t i = 0; i < mapOperands.size(); i++) { - if (targetRegion.getArgument(i).use_empty()) { - targetRegion.eraseArgument(i); - mapOperands.erase(&mapOperands[i]); - i--; - } - } - LogicalResult bodyGenStatus = success(); - using InsertPointTy = llvm::OpenMPIRBuilder::InsertPointTy; auto bodyCB = [&](InsertPointTy allocaIP, InsertPointTy codeGenIP) -> InsertPointTy { @@ -2358,8 +2341,8 @@ convertOmpTarget(Operation &opInst, llvm::IRBuilderBase &builder, for (auto &mapOp : mapOperands) { auto mapInfoOp = mlir::dyn_cast(mapOp.getDefiningOp()); - llvm::Value *mapOpValue = moduleTranslation.lookupValue( - mapInfoOp.getVarPtr() ? mapInfoOp.getVarPtr() : mapInfoOp.getVal()); + llvm::Value *mapOpValue = + moduleTranslation.lookupValue(mapInfoOp.getVarPtr()); const auto &arg = targetRegion.front().getArgument(argIndex); moduleTranslation.mapValue(arg, mapOpValue); argIndex++; diff --git a/mlir/test/Dialect/OpenMP/invalid.mlir b/mlir/test/Dialect/OpenMP/invalid.mlir index 42e9fb1c64baec..e54808f6cfdee5 100644 --- a/mlir/test/Dialect/OpenMP/invalid.mlir +++ b/mlir/test/Dialect/OpenMP/invalid.mlir @@ -1658,40 +1658,4 @@ func.func @omp_target_exit_data(%map1: memref) { return } -// ----- - -func.func @omp_map1(%map1: memref, %map2: i32) { - %mapv = omp.map_info var_ptr(%map1 : memref, tensor) val(%map2 : i32) map_clauses(tofrom) capture(ByRef) -> memref {name = ""} - // expected-error @below {{only one of val or var_ptr must be used}} - omp.target map_entries(%mapv -> %arg0: memref) { - ^bb0(%arg0: memref): - omp.terminator - } - return -} - -// ----- - -func.func @omp_map2(%map1: memref, %map2: i32) { - %mapv = omp.map_info var_ptr( : , tensor) val(%map2 : i32) map_clauses(tofrom) capture(ByRef) -> memref {name = ""} - // expected-error @below {{var_type supplied without var_ptr}} - omp.target map_entries(%mapv -> %arg0: memref) { - ^bb0(%arg0: memref): - omp.terminator - } - return -} - -// ----- - -func.func @omp_map3(%map1: memref, %map2: i32) { - %mapv = omp.map_info map_clauses(tofrom) capture(ByRef) -> memref {name = ""} - // expected-error @below {{missing val or var_ptr}} - omp.target map_entries(%mapv -> %arg0: memref) { - ^bb0(%arg0: memref): - omp.terminator - } - return -} - llvm.mlir.global internal @_QFsubEx() : i32 diff --git a/openmp/libomptarget/test/offloading/fortran/constant-arr-index.f90 b/openmp/libomptarget/test/offloading/fortran/constant-arr-index.f90 index 91dc30cf9604c4..9064f60896f105 100644 --- a/openmp/libomptarget/test/offloading/fortran/constant-arr-index.f90 +++ b/openmp/libomptarget/test/offloading/fortran/constant-arr-index.f90 @@ -1,5 +1,5 @@ ! Basic offloading test with a target region -! that checks constant indexing on device +! that checks constant indexing on device ! correctly works (regression test for prior ! bug). ! REQUIRES: flang, amdgcn-amd-amdhsa @@ -19,8 +19,8 @@ program main sp(5) = 10 !$omp end target - ! print *, sp(1) - ! print *, sp(5) + print *, sp(1) + print *, sp(5) end program ! CHECK: 20 diff --git a/openmp/libomptarget/test/offloading/fortran/basic-target-region-array.f90 b/openmp/libomptarget/test/offloading/fortran/target-region-implicit-array.f90 similarity index 87% rename from openmp/libomptarget/test/offloading/fortran/basic-target-region-array.f90 rename to openmp/libomptarget/test/offloading/fortran/target-region-implicit-array.f90 index 9b10e4c7650d05..5ef2547545e4b9 100644 --- a/openmp/libomptarget/test/offloading/fortran/basic-target-region-array.f90 +++ b/openmp/libomptarget/test/offloading/fortran/target-region-implicit-array.f90 @@ -13,14 +13,13 @@ program main integer :: i = 1 integer :: j = 11 - !$omp target map(tofrom:x, i, j) - do while (i <= j) + !$omp target + do i = 1, j x(i) = i; - i = i + 1 - end do + end do !$omp end target PRINT *, x(:) end program main - + ! CHECK: 1 2 3 4 5 6 7 8 9 10 From 6bdeb53ed9ad85fc16f495120b4e2382c4bdaafa Mon Sep 17 00:00:00 2001 From: Akash Banerjee Date: Fri, 24 Nov 2023 11:33:55 +0000 Subject: [PATCH 15/35] [MLIR][OpenMP] Fix the assertion failure for VariableCaptureKind::ByCopy (#72424) --- .../OpenMP/OpenMPToLLVMIRTranslation.cpp | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp index a310d38b26cb12..de5404be72ee5e 100644 --- a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp +++ b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp @@ -2197,16 +2197,11 @@ createDeviceArgumentAccessor(MapInfoData &mapData, llvm::Argument &arg, ompBuilder.M.getDataLayout().getProgramAddressSpace(); // Create the alloca for the argument the current point. - llvm::Value *v = - builder.CreateAlloca(arg.getType()->isPointerTy() - ? arg.getType() - : llvm::Type::getInt64Ty(builder.getContext()), - ompBuilder.M.getDataLayout().getAllocaAddrSpace()); + llvm::Value *v = builder.CreateAlloca(arg.getType(), allocaAS); - if (allocaAS != defaultAS && arg.getType()->isPointerTy()) { + if (allocaAS != defaultAS && arg.getType()->isPointerTy()) v = builder.CreatePointerBitCastOrAddrSpaceCast( v, arg.getType()->getPointerTo(defaultAS)); - } builder.CreateStore(&arg, v); @@ -2214,15 +2209,7 @@ createDeviceArgumentAccessor(MapInfoData &mapData, llvm::Argument &arg, switch (capture) { case mlir::omp::VariableCaptureKind::ByCopy: { - // RHS of || aims to ignore conversions like int -> uint, but further - // extension of this path must be implemented for the moment it'll fall - // through to the assert. - if (inputType->isPointerTy() || v->getType() == inputType->getPointerTo()) { - retVal = v; - return builder.saveIP(); - } - - assert(false && "Currently unsupported OMPTargetVarCaptureByCopy Type"); + retVal = v; break; } case mlir::omp::VariableCaptureKind::ByRef: { From a4ee55fe6ea088f55bf44236bd05f6a847a3de6c Mon Sep 17 00:00:00 2001 From: Alexander Batashev Date: Fri, 24 Nov 2023 15:13:39 +0300 Subject: [PATCH 16/35] [MLIR][NFC] Fix build on recent GCC with C++20 enabled (#73308) The following pattern fails on recent GCC versions with -std=c++20 flag passed and succeeds with -std=c++17. Such behavior is not observed on Clang 16.0. ``` template struct Foo { Foo(int a) {} }; ``` This patch removes template parameter from constructor in two occurences to make the following command complete successfully: bazel build -c fastbuild --cxxopt=-std=c++20 --host_cxxopt=-std=c++20 @llvm-project//mlir/... This patch is similar to https://reviews.llvm.org/D154782 Co-authored-by: Alexander Batashev --- mlir/lib/Conversion/ComplexToLibm/ComplexToLibm.cpp | 6 ++---- mlir/lib/Conversion/MathToLibm/MathToLibm.cpp | 4 ++-- mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRV.cpp | 4 ++-- mlir/lib/Pass/PassRegistry.cpp | 2 +- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/mlir/lib/Conversion/ComplexToLibm/ComplexToLibm.cpp b/mlir/lib/Conversion/ComplexToLibm/ComplexToLibm.cpp index 3b8338673a5e32..b3762f0293492c 100644 --- a/mlir/lib/Conversion/ComplexToLibm/ComplexToLibm.cpp +++ b/mlir/lib/Conversion/ComplexToLibm/ComplexToLibm.cpp @@ -55,10 +55,8 @@ template struct ScalarOpToLibmCall : public OpRewritePattern { public: using OpRewritePattern::OpRewritePattern; - ScalarOpToLibmCall(MLIRContext *context, - StringRef floatFunc, - StringRef doubleFunc, - PatternBenefit benefit) + ScalarOpToLibmCall(MLIRContext *context, StringRef floatFunc, + StringRef doubleFunc, PatternBenefit benefit) : OpRewritePattern(context, benefit), floatFunc(floatFunc), doubleFunc(doubleFunc){}; diff --git a/mlir/lib/Conversion/MathToLibm/MathToLibm.cpp b/mlir/lib/Conversion/MathToLibm/MathToLibm.cpp index 7fd94116ef7a6e..103c1fb8c3822e 100644 --- a/mlir/lib/Conversion/MathToLibm/MathToLibm.cpp +++ b/mlir/lib/Conversion/MathToLibm/MathToLibm.cpp @@ -50,8 +50,8 @@ template struct ScalarOpToLibmCall : public OpRewritePattern { public: using OpRewritePattern::OpRewritePattern; - ScalarOpToLibmCall(MLIRContext *context, StringRef floatFunc, - StringRef doubleFunc) + ScalarOpToLibmCall(MLIRContext *context, StringRef floatFunc, + StringRef doubleFunc) : OpRewritePattern(context), floatFunc(floatFunc), doubleFunc(doubleFunc){}; diff --git a/mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRV.cpp b/mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRV.cpp index e749f2bc101297..febfe97f6c0a99 100644 --- a/mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRV.cpp +++ b/mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRV.cpp @@ -96,8 +96,8 @@ Region::iterator getBlockIt(Region ®ion, unsigned index) { template class SCFToSPIRVPattern : public OpConversionPattern { public: - SCFToSPIRVPattern(MLIRContext *context, SPIRVTypeConverter &converter, - ScfToSPIRVContextImpl *scfToSPIRVContext) + SCFToSPIRVPattern(MLIRContext *context, SPIRVTypeConverter &converter, + ScfToSPIRVContextImpl *scfToSPIRVContext) : OpConversionPattern::OpConversionPattern(converter, context), scfToSPIRVContext(scfToSPIRVContext), typeConverter(converter) {} diff --git a/mlir/lib/Pass/PassRegistry.cpp b/mlir/lib/Pass/PassRegistry.cpp index b0c314369190a4..35ac4b8fd280ea 100644 --- a/mlir/lib/Pass/PassRegistry.cpp +++ b/mlir/lib/Pass/PassRegistry.cpp @@ -373,7 +373,7 @@ llvm::cl::OptionValue::operator=( return *this; } -llvm::cl::OptionValue::~OptionValue() = default; +llvm::cl::OptionValue::~OptionValue() = default; void llvm::cl::OptionValue::setValue( const OpPassManager &newValue) { From cf1bde33423da5eb9b7dc95daac4aada3167de3c Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Fri, 24 Nov 2023 09:17:21 -0300 Subject: [PATCH 17/35] [clang] Fix sorting module headers (#73146) Struct Module::Header is not a POD type. As such, qsort() and llvm::array_pod_sort() must not be used to sort it. This became an issue with the new implementation of qsort() in glibc 2.39 that is not guaranteed to be a stable sort, causing Headers to be re-ordered and corrupted. Replace the usage of llvm::array_pod_sort() with std::stable_sort() in order to fix this issue. The signature of compareModuleHeaders() has to be modified. Fixes #73145. --- clang/lib/Lex/ModuleMap.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp index 00e13c9be4a7d7..1d67e275cb4775 100644 --- a/clang/lib/Lex/ModuleMap.cpp +++ b/clang/lib/Lex/ModuleMap.cpp @@ -2509,9 +2509,9 @@ void ModuleMapParser::parseHeaderDecl(MMToken::TokenKind LeadingToken, << FixItHint::CreateReplacement(CurrModuleDeclLoc, "framework module"); } -static int compareModuleHeaders(const Module::Header *A, - const Module::Header *B) { - return A->NameAsWritten.compare(B->NameAsWritten); +static bool compareModuleHeaders(const Module::Header &A, + const Module::Header &B) { + return A.NameAsWritten < B.NameAsWritten; } /// Parse an umbrella directory declaration. @@ -2574,7 +2574,7 @@ void ModuleMapParser::parseUmbrellaDirDecl(SourceLocation UmbrellaLoc) { } // Sort header paths so that the pcm doesn't depend on iteration order. - llvm::array_pod_sort(Headers.begin(), Headers.end(), compareModuleHeaders); + std::stable_sort(Headers.begin(), Headers.end(), compareModuleHeaders); for (auto &Header : Headers) Map.addHeader(ActiveModule, std::move(Header), ModuleMap::TextualHeader); From de6c9c84e2eec2d1ef865a8d9d1775d78ca0cc51 Mon Sep 17 00:00:00 2001 From: pasmpe01 Date: Tue, 21 Nov 2023 10:08:53 +0000 Subject: [PATCH 18/35] [TLI][AArch64] Add TLI Mappings of @llvm.exp10 for ArmPL and SLEEF. Update regex to _explicitly_ show which exp versions are added. The previous regex used `exp[^e]` to avoid matching calls like: `@llvm.experimental.stepvector`. Note: ArmPL Mappings for scalable types are not yet utilized (eg, `llvm.exp10.nxv2f64`, `llvm.exp10.nxv4f32`), as `replace-with-veclib` pass needs improvements. --- llvm/include/llvm/Analysis/VecFuncs.def | 9 ++ .../replace-intrinsics-with-veclib-armpl.ll | 46 +++++++- ...e-intrinsics-with-veclib-sleef-scalable.ll | 20 ++++ .../replace-intrinsics-with-veclib-sleef.ll | 22 +++- .../LoopVectorize/AArch64/armpl-intrinsics.ll | 51 +++++++++ .../AArch64/sleef-intrinsic-calls-aarch64.ll | 107 ++++++++++++++---- 6 files changed, 232 insertions(+), 23 deletions(-) diff --git a/llvm/include/llvm/Analysis/VecFuncs.def b/llvm/include/llvm/Analysis/VecFuncs.def index b2e989e4013ea0..c628e72b24d12b 100644 --- a/llvm/include/llvm/Analysis/VecFuncs.def +++ b/llvm/include/llvm/Analysis/VecFuncs.def @@ -492,6 +492,7 @@ TLI_DEFINE_VECFUNC( "exp2", "_ZGVnN2v_exp2", FIXED(2), "_ZGV_LLVM_N2v") TLI_DEFINE_VECFUNC( "llvm.exp2.f64", "_ZGVnN2v_exp2", FIXED(2), "_ZGV_LLVM_N2v") TLI_DEFINE_VECFUNC( "exp10", "_ZGVnN2v_exp10", FIXED(2), "_ZGV_LLVM_N2v") +TLI_DEFINE_VECFUNC( "llvm.exp10.f64", "_ZGVnN2v_exp10", FIXED(2), "_ZGV_LLVM_N2v") TLI_DEFINE_VECFUNC( "lgamma", "_ZGVnN2v_lgamma", FIXED(2), "_ZGV_LLVM_N2v") @@ -544,6 +545,7 @@ TLI_DEFINE_VECFUNC( "exp2f", "_ZGVnN4v_exp2f", FIXED(4), "_ZGV_LLVM_N4v") TLI_DEFINE_VECFUNC( "llvm.exp2.f32", "_ZGVnN4v_exp2f", FIXED(4), "_ZGV_LLVM_N4v") TLI_DEFINE_VECFUNC( "exp10f", "_ZGVnN4v_exp10f", FIXED(4), "_ZGV_LLVM_N4v") +TLI_DEFINE_VECFUNC( "llvm.exp10.f32", "_ZGVnN4v_exp10f", FIXED(4), "_ZGV_LLVM_N4v") TLI_DEFINE_VECFUNC( "lgammaf", "_ZGVnN4v_lgammaf", FIXED(4), "_ZGV_LLVM_N4v") @@ -609,6 +611,8 @@ TLI_DEFINE_VECFUNC("llvm.exp2.f32", "_ZGVsMxv_exp2f", SCALABLE(4), MASKED, "_ZGV TLI_DEFINE_VECFUNC("exp10", "_ZGVsMxv_exp10", SCALABLE(2), MASKED, "_ZGVsMxv") TLI_DEFINE_VECFUNC("exp10f", "_ZGVsMxv_exp10f", SCALABLE(4), MASKED, "_ZGVsMxv") +TLI_DEFINE_VECFUNC("llvm.exp10.f64", "_ZGVsMxv_exp10", SCALABLE(2), MASKED, "_ZGVsMxv") +TLI_DEFINE_VECFUNC("llvm.exp10.f32", "_ZGVsMxv_exp10f", SCALABLE(4), MASKED, "_ZGVsMxv") TLI_DEFINE_VECFUNC("fmod", "_ZGVsMxvv_fmod", SCALABLE(2), MASKED, "_ZGVsMxvv") TLI_DEFINE_VECFUNC("fmodf", "_ZGVsMxvv_fmodf", SCALABLE(4), MASKED, "_ZGVsMxvv") @@ -753,6 +757,11 @@ TLI_DEFINE_VECFUNC("exp10f", "armpl_vexp10q_f32", FIXED(4), NOMASK, "_ZGV_LLVM_N TLI_DEFINE_VECFUNC("exp10", "armpl_svexp10_f64_x", SCALABLE(2), MASKED, "_ZGVsMxv") TLI_DEFINE_VECFUNC("exp10f", "armpl_svexp10_f32_x", SCALABLE(4), MASKED, "_ZGVsMxv") +TLI_DEFINE_VECFUNC("llvm.exp10.f64", "armpl_vexp10q_f64", FIXED(2), NOMASK, "_ZGV_LLVM_N2v") +TLI_DEFINE_VECFUNC("llvm.exp10.f32", "armpl_vexp10q_f32", FIXED(4), NOMASK, "_ZGV_LLVM_N4v") +TLI_DEFINE_VECFUNC("llvm.exp10.f64", "armpl_svexp10_f64_x", SCALABLE(2), MASKED, "_ZGVsMxv") +TLI_DEFINE_VECFUNC("llvm.exp10.f32", "armpl_svexp10_f32_x", SCALABLE(4), MASKED, "_ZGVsMxv") + TLI_DEFINE_VECFUNC("expm1", "armpl_vexpm1q_f64", FIXED(2), NOMASK, "_ZGV_LLVM_N2v") TLI_DEFINE_VECFUNC("expm1f", "armpl_vexpm1q_f32", FIXED(4), NOMASK, "_ZGV_LLVM_N4v") TLI_DEFINE_VECFUNC("expm1", "armpl_svexpm1_f64_x", SCALABLE(2), MASKED, "_ZGVsMxv") diff --git a/llvm/test/CodeGen/AArch64/replace-intrinsics-with-veclib-armpl.ll b/llvm/test/CodeGen/AArch64/replace-intrinsics-with-veclib-armpl.ll index 127514961f48df..a38d4a53407c5d 100644 --- a/llvm/test/CodeGen/AArch64/replace-intrinsics-with-veclib-armpl.ll +++ b/llvm/test/CodeGen/AArch64/replace-intrinsics-with-veclib-armpl.ll @@ -15,7 +15,7 @@ declare @llvm.cos.nxv2f64() declare @llvm.cos.nxv4f32() ;. -; CHECK: @[[LLVM_COMPILER_USED:[a-zA-Z0-9_$"\\.-]+]] = appending global [14 x ptr] [ptr @armpl_vcosq_f64, ptr @armpl_vcosq_f32, ptr @armpl_vsinq_f64, ptr @armpl_vsinq_f32, ptr @armpl_vexpq_f64, ptr @armpl_vexpq_f32, ptr @armpl_vexp2q_f64, ptr @armpl_vexp2q_f32, ptr @armpl_vlogq_f64, ptr @armpl_vlogq_f32, ptr @armpl_vlog2q_f64, ptr @armpl_vlog2q_f32, ptr @armpl_vlog10q_f64, ptr @armpl_vlog10q_f32], section "llvm.metadata" +; CHECK: @[[LLVM_COMPILER_USED:[a-zA-Z0-9_$"\\.-]+]] = appending global [16 x ptr] [ptr @armpl_vcosq_f64, ptr @armpl_vcosq_f32, ptr @armpl_vsinq_f64, ptr @armpl_vsinq_f32, ptr @armpl_vexpq_f64, ptr @armpl_vexpq_f32, ptr @armpl_vexp2q_f64, ptr @armpl_vexp2q_f32, ptr @armpl_vexp10q_f64, ptr @armpl_vexp10q_f32, ptr @armpl_vlogq_f64, ptr @armpl_vlogq_f32, ptr @armpl_vlog2q_f64, ptr @armpl_vlog2q_f32, ptr @armpl_vlog10q_f64, ptr @armpl_vlog10q_f32], section "llvm.metadata" ;. define <2 x double> @llvm_cos_f64(<2 x double> %in) { ; CHECK-LABEL: define <2 x double> @llvm_cos_f64 @@ -192,6 +192,50 @@ define @llvm_exp2_vscale_f32( %in) #0 { ret %1 } +declare <2 x double> @llvm.exp10.v2f64(<2 x double>) +declare <4 x float> @llvm.exp10.v4f32(<4 x float>) +declare @llvm.exp10.nxv2f64() +declare @llvm.exp10.nxv4f32() + +define <2 x double> @llvm_exp10_f64(<2 x double> %in) { +; CHECK-LABEL: define <2 x double> @llvm_exp10_f64 +; CHECK-SAME: (<2 x double> [[IN:%.*]]) { +; CHECK-NEXT: [[TMP1:%.*]] = call fast <2 x double> @armpl_vexp10q_f64(<2 x double> [[IN]]) +; CHECK-NEXT: ret <2 x double> [[TMP1]] +; + %1 = call fast <2 x double> @llvm.exp10.v2f64(<2 x double> %in) + ret <2 x double> %1 +} + +define <4 x float> @llvm_exp10_f32(<4 x float> %in) { +; CHECK-LABEL: define <4 x float> @llvm_exp10_f32 +; CHECK-SAME: (<4 x float> [[IN:%.*]]) { +; CHECK-NEXT: [[TMP1:%.*]] = call fast <4 x float> @armpl_vexp10q_f32(<4 x float> [[IN]]) +; CHECK-NEXT: ret <4 x float> [[TMP1]] +; + %1 = call fast <4 x float> @llvm.exp10.v4f32(<4 x float> %in) + ret <4 x float> %1 +} + +define @llvm_exp10_vscale_f64( %in) #0 { +; CHECK-LABEL: define @llvm_exp10_vscale_f64 +; CHECK-SAME: ( [[IN:%.*]]) #[[ATTR1]] { +; CHECK-NEXT: [[TMP1:%.*]] = call fast @llvm.exp10.nxv2f64( [[IN]]) +; CHECK-NEXT: ret [[TMP1]] +; + %1 = call fast @llvm.exp10.nxv2f64( %in) + ret %1 +} + +define @llvm_exp10_vscale_f32( %in) #0 { +; CHECK-LABEL: define @llvm_exp10_vscale_f32 +; CHECK-SAME: ( [[IN:%.*]]) #[[ATTR1]] { +; CHECK-NEXT: [[TMP1:%.*]] = call fast @llvm.exp10.nxv4f32( [[IN]]) +; CHECK-NEXT: ret [[TMP1]] +; + %1 = call fast @llvm.exp10.nxv4f32( %in) + ret %1 +} declare <2 x double> @llvm.log.v2f64(<2 x double>) declare <4 x float> @llvm.log.v4f32(<4 x float>) diff --git a/llvm/test/CodeGen/AArch64/replace-intrinsics-with-veclib-sleef-scalable.ll b/llvm/test/CodeGen/AArch64/replace-intrinsics-with-veclib-sleef-scalable.ll index f05af5268e957e..8b06c41bcb1a6d 100644 --- a/llvm/test/CodeGen/AArch64/replace-intrinsics-with-veclib-sleef-scalable.ll +++ b/llvm/test/CodeGen/AArch64/replace-intrinsics-with-veclib-sleef-scalable.ll @@ -95,6 +95,24 @@ define @llvm_exp2_vscale_f32( %in) { ret %1 } +define @llvm_exp10_vscale_f64( %in) { +; CHECK-LABEL: @llvm_exp10_vscale_f64( +; CHECK-NEXT: [[TMP1:%.*]] = call fast @llvm.exp10.nxv2f64( [[IN:%.*]]) +; CHECK-NEXT: ret [[TMP1]] +; + %1 = call fast @llvm.exp10.nxv2f64( %in) + ret %1 +} + +define @llvm_exp10_vscale_f32( %in) { +; CHECK-LABEL: @llvm_exp10_vscale_f32( +; CHECK-NEXT: [[TMP1:%.*]] = call fast @llvm.exp10.nxv4f32( [[IN:%.*]]) +; CHECK-NEXT: ret [[TMP1]] +; + %1 = call fast @llvm.exp10.nxv4f32( %in) + ret %1 +} + define @llvm_fabs_vscale_f64( %in) { ; CHECK-LABEL: @llvm_fabs_vscale_f64( ; CHECK-NEXT: [[TMP1:%.*]] = call fast @llvm.fabs.nxv2f64( [[IN:%.*]]) @@ -375,6 +393,8 @@ declare @llvm.exp.nxv2f64() declare @llvm.exp.nxv4f32() declare @llvm.exp2.nxv2f64() declare @llvm.exp2.nxv4f32() +declare @llvm.exp10.nxv2f64() +declare @llvm.exp10.nxv4f32() declare @llvm.fabs.nxv2f64() declare @llvm.fabs.nxv4f32() declare @llvm.floor.nxv2f64() diff --git a/llvm/test/CodeGen/AArch64/replace-intrinsics-with-veclib-sleef.ll b/llvm/test/CodeGen/AArch64/replace-intrinsics-with-veclib-sleef.ll index 5dd87a4bb29550..cedb7dd85149d0 100644 --- a/llvm/test/CodeGen/AArch64/replace-intrinsics-with-veclib-sleef.ll +++ b/llvm/test/CodeGen/AArch64/replace-intrinsics-with-veclib-sleef.ll @@ -4,7 +4,7 @@ target triple = "aarch64-unknown-linux-gnu" ;. -; CHECK: @[[LLVM_COMPILER_USED:[a-zA-Z0-9_$"\\.-]+]] = appending global [14 x ptr] [ptr @_ZGVnN2v_cos, ptr @_ZGVnN4v_cosf, ptr @_ZGVnN2v_exp, ptr @_ZGVnN4v_expf, ptr @_ZGVnN2v_exp2, ptr @_ZGVnN4v_exp2f, ptr @_ZGVnN2v_log, ptr @_ZGVnN4v_logf, ptr @_ZGVnN2v_log10, ptr @_ZGVnN4v_log10f, ptr @_ZGVnN2v_log2, ptr @_ZGVnN4v_log2f, ptr @_ZGVnN2v_sin, ptr @_ZGVnN4v_sinf], section "llvm.metadata" +; CHECK: @[[LLVM_COMPILER_USED:[a-zA-Z0-9_$"\\.-]+]] = appending global [16 x ptr] [ptr @_ZGVnN2v_cos, ptr @_ZGVnN4v_cosf, ptr @_ZGVnN2v_exp, ptr @_ZGVnN4v_expf, ptr @_ZGVnN2v_exp2, ptr @_ZGVnN4v_exp2f, ptr @_ZGVnN2v_exp10, ptr @_ZGVnN4v_exp10f, ptr @_ZGVnN2v_log, ptr @_ZGVnN4v_logf, ptr @_ZGVnN2v_log10, ptr @_ZGVnN4v_log10f, ptr @_ZGVnN2v_log2, ptr @_ZGVnN4v_log2f, ptr @_ZGVnN2v_sin, ptr @_ZGVnN4v_sinf], section "llvm.metadata" ;. define <2 x double> @llvm_ceil_f64(<2 x double> %in) { ; CHECK-LABEL: @llvm_ceil_f64( @@ -96,6 +96,24 @@ define <4 x float> @llvm_exp2_f32(<4 x float> %in) { ret <4 x float> %1 } +define <2 x double> @llvm_exp10_f64(<2 x double> %in) { +; CHECK-LABEL: @llvm_exp10_f64( +; CHECK-NEXT: [[TMP1:%.*]] = call fast <2 x double> @_ZGVnN2v_exp10(<2 x double> [[IN:%.*]]) +; CHECK-NEXT: ret <2 x double> [[TMP1]] +; + %1 = call fast <2 x double> @llvm.exp10.v2f64(<2 x double> %in) + ret <2 x double> %1 +} + +define <4 x float> @llvm_exp10_f32(<4 x float> %in) { +; CHECK-LABEL: @llvm_exp10_f32( +; CHECK-NEXT: [[TMP1:%.*]] = call fast <4 x float> @_ZGVnN4v_exp10f(<4 x float> [[IN:%.*]]) +; CHECK-NEXT: ret <4 x float> [[TMP1]] +; + %1 = call fast <4 x float> @llvm.exp10.v4f32(<4 x float> %in) + ret <4 x float> %1 +} + define <2 x double> @llvm_fabs_f64(<2 x double> %in) { ; CHECK-LABEL: @llvm_fabs_f64( ; CHECK-NEXT: [[TMP1:%.*]] = call fast <2 x double> @llvm.fabs.v2f64(<2 x double> [[IN:%.*]]) @@ -376,6 +394,8 @@ declare <2 x double> @llvm.exp.v2f64(<2 x double>) declare <4 x float> @llvm.exp.v4f32(<4 x float>) declare <2 x double> @llvm.exp2.v2f64(<2 x double>) declare <4 x float> @llvm.exp2.v4f32(<4 x float>) +declare <2 x double> @llvm.exp10.v2f64(<2 x double>) +declare <4 x float> @llvm.exp10.v4f32(<4 x float>) declare <2 x double> @llvm.fabs.v2f64(<2 x double>) declare <4 x float> @llvm.fabs.v4f32(<4 x float>) declare <2 x double> @llvm.floor.v2f64(<2 x double>) diff --git a/llvm/test/Transforms/LoopVectorize/AArch64/armpl-intrinsics.ll b/llvm/test/Transforms/LoopVectorize/AArch64/armpl-intrinsics.ll index 0a27c74782ccba..03d959c928577d 100644 --- a/llvm/test/Transforms/LoopVectorize/AArch64/armpl-intrinsics.ll +++ b/llvm/test/Transforms/LoopVectorize/AArch64/armpl-intrinsics.ll @@ -161,6 +161,57 @@ define void @exp2_f32(ptr nocapture %in.ptr, ptr %out.ptr) { ret void } +declare double @llvm.exp10.f64(double) +declare float @llvm.exp10.f32(float) + +define void @exp10_f64(ptr nocapture %in.ptr, ptr %out.ptr) { +; CHECK-LABEL: @exp10_f64( +; NEON: [[TMP5:%.*]] = call <2 x double> @armpl_vexp10q_f64(<2 x double> [[TMP4:%.*]]) +; SVE: [[TMP5:%.*]] = call @armpl_svexp10_f64_x( [[TMP4:%.*]], {{.*}}) +; CHECK: ret void +; + entry: + br label %for.body + + for.body: + %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ] + %in.gep = getelementptr inbounds double, ptr %in.ptr, i64 %iv + %in = load double, ptr %in.gep, align 8 + %call = tail call double @llvm.exp10.f64(double %in) + %out.gep = getelementptr inbounds double, ptr %out.ptr, i64 %iv + store double %call, ptr %out.gep, align 8 + %iv.next = add nuw nsw i64 %iv, 1 + %exitcond = icmp eq i64 %iv.next, 1000 + br i1 %exitcond, label %for.end, label %for.body + + for.end: + ret void +} + +define void @exp10_f32(ptr nocapture %in.ptr, ptr %out.ptr) { +; CHECK-LABEL: @exp10_f32( +; NEON: [[TMP5:%.*]] = call <4 x float> @armpl_vexp10q_f32(<4 x float> [[TMP4:%.*]]) +; SVE: [[TMP5:%.*]] = call @armpl_svexp10_f32_x( [[TMP4:%.*]], {{.*}}) +; CHECK: ret void +; + entry: + br label %for.body + + for.body: + %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ] + %in.gep = getelementptr inbounds float, ptr %in.ptr, i64 %iv + %in = load float, ptr %in.gep, align 8 + %call = tail call float @llvm.exp10.f32(float %in) + %out.gep = getelementptr inbounds float, ptr %out.ptr, i64 %iv + store float %call, ptr %out.gep, align 4 + %iv.next = add nuw nsw i64 %iv, 1 + %exitcond = icmp eq i64 %iv.next, 1000 + br i1 %exitcond, label %for.end, label %for.body + + for.end: + ret void +} + declare double @llvm.log.f64(double) declare float @llvm.log.f32(float) diff --git a/llvm/test/Transforms/LoopVectorize/AArch64/sleef-intrinsic-calls-aarch64.ll b/llvm/test/Transforms/LoopVectorize/AArch64/sleef-intrinsic-calls-aarch64.ll index 715c2c352b7762..01ce3657835a46 100644 --- a/llvm/test/Transforms/LoopVectorize/AArch64/sleef-intrinsic-calls-aarch64.ll +++ b/llvm/test/Transforms/LoopVectorize/AArch64/sleef-intrinsic-calls-aarch64.ll @@ -1,4 +1,4 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --filter "(\.|_)(ceil|copysign|cos|exp[^e]|exp2|fabs|floor|fma|log|m..num|pow|.*int|round|sin|sqrt|trunc)|(ret)" --version 2 +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --filter "(\.|_)(ceil|copysign|cos|exp\.|expf?\(|exp2|exp10|fabs|floor|fma|log|m..num|pow|.*int|round|sin|sqrt|trunc)|(ret)" --version 2 ; RUN: opt -vector-library=sleefgnuabi -passes=inject-tli-mappings,loop-vectorize -force-vector-interleave=1 -S < %s | FileCheck %s --check-prefix=NEON ; RUN: opt -mattr=+sve -vector-library=sleefgnuabi -passes=inject-tli-mappings,loop-vectorize -force-vector-interleave=1 -S < %s | FileCheck %s --check-prefix=SVE @@ -334,6 +334,71 @@ define void @llvm_exp2_f32(float* nocapture %varray) { ret void } +declare double @llvm.exp10.f64(double) +declare float @llvm.exp10.f32(float) + +define void @llvm_exp10_f64(double* nocapture %varray) { +; NEON-LABEL: define void @llvm_exp10_f64 +; NEON-SAME: (ptr nocapture [[VARRAY:%.*]]) { +; NEON: [[TMP2:%.*]] = call <2 x double> @_ZGVnN2v_exp10(<2 x double> [[TMP1:%.*]]) +; NEON: [[CALL:%.*]] = tail call double @llvm.exp10.f64(double [[CONV:%.*]]) #[[ATTR7:[0-9]+]] +; NEON: ret void +; +; SVE-LABEL: define void @llvm_exp10_f64 +; SVE-SAME: (ptr nocapture [[VARRAY:%.*]]) #[[ATTR1]] { +; SVE: [[TMP12:%.*]] = call @_ZGVsMxv_exp10( [[TMP11:%.*]], shufflevector ( insertelement ( poison, i1 true, i64 0), poison, zeroinitializer)) +; SVE: [[CALL:%.*]] = tail call double @llvm.exp10.f64(double [[CONV:%.*]]) #[[ATTR10:[0-9]+]] +; SVE: ret void +; + entry: + br label %for.body + + for.body: + %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ] + %tmp = trunc i64 %iv to i32 + %conv = sitofp i32 %tmp to double + %call = tail call double @llvm.exp10.f64(double %conv) + %arrayidx = getelementptr inbounds double, double* %varray, i64 %iv + store double %call, double* %arrayidx, align 8 + %iv.next = add nuw nsw i64 %iv, 1 + %exitcond = icmp eq i64 %iv.next, 1000 + br i1 %exitcond, label %for.end, label %for.body + + for.end: + ret void +} + +define void @llvm_exp10_f32(float* nocapture %varray) { +; NEON-LABEL: define void @llvm_exp10_f32 +; NEON-SAME: (ptr nocapture [[VARRAY:%.*]]) { +; NEON: [[TMP2:%.*]] = call <4 x float> @_ZGVnN4v_exp10f(<4 x float> [[TMP1:%.*]]) +; NEON: [[CALL:%.*]] = tail call float @llvm.exp10.f32(float [[CONV:%.*]]) #[[ATTR8:[0-9]+]] +; NEON: ret void +; +; SVE-LABEL: define void @llvm_exp10_f32 +; SVE-SAME: (ptr nocapture [[VARRAY:%.*]]) #[[ATTR1]] { +; SVE: [[TMP12:%.*]] = call @_ZGVsMxv_exp10f( [[TMP11:%.*]], shufflevector ( insertelement ( poison, i1 true, i64 0), poison, zeroinitializer)) +; SVE: [[CALL:%.*]] = tail call float @llvm.exp10.f32(float [[CONV:%.*]]) #[[ATTR11:[0-9]+]] +; SVE: ret void +; + entry: + br label %for.body + + for.body: + %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ] + %tmp = trunc i64 %iv to i32 + %conv = sitofp i32 %tmp to float + %call = tail call float @llvm.exp10.f32(float %conv) + %arrayidx = getelementptr inbounds float, float* %varray, i64 %iv + store float %call, float* %arrayidx, align 4 + %iv.next = add nuw nsw i64 %iv, 1 + %exitcond = icmp eq i64 %iv.next, 1000 + br i1 %exitcond, label %for.end, label %for.body + + for.end: + ret void +} + declare double @llvm.fabs.f64(double) declare float @llvm.fabs.f32(float) @@ -537,13 +602,13 @@ define void @llvm_log_f64(double* nocapture %varray) { ; NEON-LABEL: define void @llvm_log_f64 ; NEON-SAME: (ptr nocapture [[VARRAY:%.*]]) { ; NEON: [[TMP2:%.*]] = call <2 x double> @_ZGVnN2v_log(<2 x double> [[TMP1:%.*]]) -; NEON: [[CALL:%.*]] = tail call double @llvm.log.f64(double [[CONV:%.*]]) #[[ATTR7:[0-9]+]] +; NEON: [[CALL:%.*]] = tail call double @llvm.log.f64(double [[CONV:%.*]]) #[[ATTR9:[0-9]+]] ; NEON: ret void ; ; SVE-LABEL: define void @llvm_log_f64 ; SVE-SAME: (ptr nocapture [[VARRAY:%.*]]) #[[ATTR1]] { ; SVE: [[TMP12:%.*]] = call @_ZGVsMxv_log( [[TMP11:%.*]], shufflevector ( insertelement ( poison, i1 true, i64 0), poison, zeroinitializer)) -; SVE: [[CALL:%.*]] = tail call double @llvm.log.f64(double [[CONV:%.*]]) #[[ATTR10:[0-9]+]] +; SVE: [[CALL:%.*]] = tail call double @llvm.log.f64(double [[CONV:%.*]]) #[[ATTR12:[0-9]+]] ; SVE: ret void ; entry: @@ -568,13 +633,13 @@ define void @llvm_log_f32(float* nocapture %varray) { ; NEON-LABEL: define void @llvm_log_f32 ; NEON-SAME: (ptr nocapture [[VARRAY:%.*]]) { ; NEON: [[TMP2:%.*]] = call <4 x float> @_ZGVnN4v_logf(<4 x float> [[TMP1:%.*]]) -; NEON: [[CALL:%.*]] = tail call float @llvm.log.f32(float [[CONV:%.*]]) #[[ATTR8:[0-9]+]] +; NEON: [[CALL:%.*]] = tail call float @llvm.log.f32(float [[CONV:%.*]]) #[[ATTR10:[0-9]+]] ; NEON: ret void ; ; SVE-LABEL: define void @llvm_log_f32 ; SVE-SAME: (ptr nocapture [[VARRAY:%.*]]) #[[ATTR1]] { ; SVE: [[TMP12:%.*]] = call @_ZGVsMxv_logf( [[TMP11:%.*]], shufflevector ( insertelement ( poison, i1 true, i64 0), poison, zeroinitializer)) -; SVE: [[CALL:%.*]] = tail call float @llvm.log.f32(float [[CONV:%.*]]) #[[ATTR11:[0-9]+]] +; SVE: [[CALL:%.*]] = tail call float @llvm.log.f32(float [[CONV:%.*]]) #[[ATTR13:[0-9]+]] ; SVE: ret void ; entry: @@ -602,13 +667,13 @@ define void @llvm_log10_f64(double* nocapture %varray) { ; NEON-LABEL: define void @llvm_log10_f64 ; NEON-SAME: (ptr nocapture [[VARRAY:%.*]]) { ; NEON: [[TMP2:%.*]] = call <2 x double> @_ZGVnN2v_log10(<2 x double> [[TMP1:%.*]]) -; NEON: [[CALL:%.*]] = tail call double @llvm.log10.f64(double [[CONV:%.*]]) #[[ATTR9:[0-9]+]] +; NEON: [[CALL:%.*]] = tail call double @llvm.log10.f64(double [[CONV:%.*]]) #[[ATTR11:[0-9]+]] ; NEON: ret void ; ; SVE-LABEL: define void @llvm_log10_f64 ; SVE-SAME: (ptr nocapture [[VARRAY:%.*]]) #[[ATTR1]] { ; SVE: [[TMP12:%.*]] = call @_ZGVsMxv_log10( [[TMP11:%.*]], shufflevector ( insertelement ( poison, i1 true, i64 0), poison, zeroinitializer)) -; SVE: [[CALL:%.*]] = tail call double @llvm.log10.f64(double [[CONV:%.*]]) #[[ATTR12:[0-9]+]] +; SVE: [[CALL:%.*]] = tail call double @llvm.log10.f64(double [[CONV:%.*]]) #[[ATTR14:[0-9]+]] ; SVE: ret void ; entry: @@ -633,13 +698,13 @@ define void @llvm_log10_f32(float* nocapture %varray) { ; NEON-LABEL: define void @llvm_log10_f32 ; NEON-SAME: (ptr nocapture [[VARRAY:%.*]]) { ; NEON: [[TMP2:%.*]] = call <4 x float> @_ZGVnN4v_log10f(<4 x float> [[TMP1:%.*]]) -; NEON: [[CALL:%.*]] = tail call float @llvm.log10.f32(float [[CONV:%.*]]) #[[ATTR10:[0-9]+]] +; NEON: [[CALL:%.*]] = tail call float @llvm.log10.f32(float [[CONV:%.*]]) #[[ATTR12:[0-9]+]] ; NEON: ret void ; ; SVE-LABEL: define void @llvm_log10_f32 ; SVE-SAME: (ptr nocapture [[VARRAY:%.*]]) #[[ATTR1]] { ; SVE: [[TMP12:%.*]] = call @_ZGVsMxv_log10f( [[TMP11:%.*]], shufflevector ( insertelement ( poison, i1 true, i64 0), poison, zeroinitializer)) -; SVE: [[CALL:%.*]] = tail call float @llvm.log10.f32(float [[CONV:%.*]]) #[[ATTR13:[0-9]+]] +; SVE: [[CALL:%.*]] = tail call float @llvm.log10.f32(float [[CONV:%.*]]) #[[ATTR15:[0-9]+]] ; SVE: ret void ; entry: @@ -667,13 +732,13 @@ define void @llvm_log2_f64(double* nocapture %varray) { ; NEON-LABEL: define void @llvm_log2_f64 ; NEON-SAME: (ptr nocapture [[VARRAY:%.*]]) { ; NEON: [[TMP2:%.*]] = call <2 x double> @_ZGVnN2v_log2(<2 x double> [[TMP1:%.*]]) -; NEON: [[CALL:%.*]] = tail call double @llvm.log2.f64(double [[CONV:%.*]]) #[[ATTR11:[0-9]+]] +; NEON: [[CALL:%.*]] = tail call double @llvm.log2.f64(double [[CONV:%.*]]) #[[ATTR13:[0-9]+]] ; NEON: ret void ; ; SVE-LABEL: define void @llvm_log2_f64 ; SVE-SAME: (ptr nocapture [[VARRAY:%.*]]) #[[ATTR1]] { ; SVE: [[TMP12:%.*]] = call @_ZGVsMxv_log2( [[TMP11:%.*]], shufflevector ( insertelement ( poison, i1 true, i64 0), poison, zeroinitializer)) -; SVE: [[CALL:%.*]] = tail call double @llvm.log2.f64(double [[CONV:%.*]]) #[[ATTR14:[0-9]+]] +; SVE: [[CALL:%.*]] = tail call double @llvm.log2.f64(double [[CONV:%.*]]) #[[ATTR16:[0-9]+]] ; SVE: ret void ; entry: @@ -698,13 +763,13 @@ define void @llvm_log2_f32(float* nocapture %varray) { ; NEON-LABEL: define void @llvm_log2_f32 ; NEON-SAME: (ptr nocapture [[VARRAY:%.*]]) { ; NEON: [[TMP2:%.*]] = call <4 x float> @_ZGVnN4v_log2f(<4 x float> [[TMP1:%.*]]) -; NEON: [[CALL:%.*]] = tail call float @llvm.log2.f32(float [[CONV:%.*]]) #[[ATTR12:[0-9]+]] +; NEON: [[CALL:%.*]] = tail call float @llvm.log2.f32(float [[CONV:%.*]]) #[[ATTR14:[0-9]+]] ; NEON: ret void ; ; SVE-LABEL: define void @llvm_log2_f32 ; SVE-SAME: (ptr nocapture [[VARRAY:%.*]]) #[[ATTR1]] { ; SVE: [[TMP12:%.*]] = call @_ZGVsMxv_log2f( [[TMP11:%.*]], shufflevector ( insertelement ( poison, i1 true, i64 0), poison, zeroinitializer)) -; SVE: [[CALL:%.*]] = tail call float @llvm.log2.f32(float [[CONV:%.*]]) #[[ATTR15:[0-9]+]] +; SVE: [[CALL:%.*]] = tail call float @llvm.log2.f32(float [[CONV:%.*]]) #[[ATTR17:[0-9]+]] ; SVE: ret void ; entry: @@ -927,13 +992,13 @@ define void @llvm_pow_f64(double* nocapture %varray) { ; NEON-LABEL: define void @llvm_pow_f64 ; NEON-SAME: (ptr nocapture [[VARRAY:%.*]]) { ; NEON: [[TMP2:%.*]] = call <2 x double> @_ZGVnN2vv_pow(<2 x double> [[TMP1:%.*]], <2 x double> [[TMP1]]) -; NEON: [[CALL:%.*]] = tail call double @llvm.pow.f64(double [[CONV:%.*]], double [[CONV]]) #[[ATTR13:[0-9]+]] +; NEON: [[CALL:%.*]] = tail call double @llvm.pow.f64(double [[CONV:%.*]], double [[CONV]]) #[[ATTR15:[0-9]+]] ; NEON: ret void ; ; SVE-LABEL: define void @llvm_pow_f64 ; SVE-SAME: (ptr nocapture [[VARRAY:%.*]]) #[[ATTR1]] { ; SVE: [[TMP12:%.*]] = call @_ZGVsMxvv_pow( [[TMP11:%.*]], [[TMP11]], shufflevector ( insertelement ( poison, i1 true, i64 0), poison, zeroinitializer)) -; SVE: [[CALL:%.*]] = tail call double @llvm.pow.f64(double [[CONV:%.*]], double [[CONV]]) #[[ATTR16:[0-9]+]] +; SVE: [[CALL:%.*]] = tail call double @llvm.pow.f64(double [[CONV:%.*]], double [[CONV]]) #[[ATTR18:[0-9]+]] ; SVE: ret void ; entry: @@ -958,13 +1023,13 @@ define void @llvm_pow_f32(float* nocapture %varray) { ; NEON-LABEL: define void @llvm_pow_f32 ; NEON-SAME: (ptr nocapture [[VARRAY:%.*]]) { ; NEON: [[TMP2:%.*]] = call <4 x float> @_ZGVnN4vv_powf(<4 x float> [[TMP1:%.*]], <4 x float> [[TMP1]]) -; NEON: [[CALL:%.*]] = tail call float @llvm.pow.f32(float [[CONV:%.*]], float [[CONV]]) #[[ATTR14:[0-9]+]] +; NEON: [[CALL:%.*]] = tail call float @llvm.pow.f32(float [[CONV:%.*]], float [[CONV]]) #[[ATTR16:[0-9]+]] ; NEON: ret void ; ; SVE-LABEL: define void @llvm_pow_f32 ; SVE-SAME: (ptr nocapture [[VARRAY:%.*]]) #[[ATTR1]] { ; SVE: [[TMP12:%.*]] = call @_ZGVsMxvv_powf( [[TMP11:%.*]], [[TMP11]], shufflevector ( insertelement ( poison, i1 true, i64 0), poison, zeroinitializer)) -; SVE: [[CALL:%.*]] = tail call float @llvm.pow.f32(float [[CONV:%.*]], float [[CONV]]) #[[ATTR17:[0-9]+]] +; SVE: [[CALL:%.*]] = tail call float @llvm.pow.f32(float [[CONV:%.*]], float [[CONV]]) #[[ATTR19:[0-9]+]] ; SVE: ret void ; entry: @@ -1122,13 +1187,13 @@ define void @llvm_sin_f64(double* nocapture %varray) { ; NEON-LABEL: define void @llvm_sin_f64 ; NEON-SAME: (ptr nocapture [[VARRAY:%.*]]) { ; NEON: [[TMP2:%.*]] = call <2 x double> @_ZGVnN2v_sin(<2 x double> [[TMP1:%.*]]) -; NEON: [[CALL:%.*]] = tail call double @llvm.sin.f64(double [[CONV:%.*]]) #[[ATTR15:[0-9]+]] +; NEON: [[CALL:%.*]] = tail call double @llvm.sin.f64(double [[CONV:%.*]]) #[[ATTR17:[0-9]+]] ; NEON: ret void ; ; SVE-LABEL: define void @llvm_sin_f64 ; SVE-SAME: (ptr nocapture [[VARRAY:%.*]]) #[[ATTR1]] { ; SVE: [[TMP12:%.*]] = call @_ZGVsMxv_sin( [[TMP11:%.*]], shufflevector ( insertelement ( poison, i1 true, i64 0), poison, zeroinitializer)) -; SVE: [[CALL:%.*]] = tail call double @llvm.sin.f64(double [[CONV:%.*]]) #[[ATTR18:[0-9]+]] +; SVE: [[CALL:%.*]] = tail call double @llvm.sin.f64(double [[CONV:%.*]]) #[[ATTR20:[0-9]+]] ; SVE: ret void ; entry: @@ -1153,13 +1218,13 @@ define void @llvm_sin_f32(float* nocapture %varray) { ; NEON-LABEL: define void @llvm_sin_f32 ; NEON-SAME: (ptr nocapture [[VARRAY:%.*]]) { ; NEON: [[TMP2:%.*]] = call <4 x float> @_ZGVnN4v_sinf(<4 x float> [[TMP1:%.*]]) -; NEON: [[CALL:%.*]] = tail call float @llvm.sin.f32(float [[CONV:%.*]]) #[[ATTR16:[0-9]+]] +; NEON: [[CALL:%.*]] = tail call float @llvm.sin.f32(float [[CONV:%.*]]) #[[ATTR18:[0-9]+]] ; NEON: ret void ; ; SVE-LABEL: define void @llvm_sin_f32 ; SVE-SAME: (ptr nocapture [[VARRAY:%.*]]) #[[ATTR1]] { ; SVE: [[TMP12:%.*]] = call @_ZGVsMxv_sinf( [[TMP11:%.*]], shufflevector ( insertelement ( poison, i1 true, i64 0), poison, zeroinitializer)) -; SVE: [[CALL:%.*]] = tail call float @llvm.sin.f32(float [[CONV:%.*]]) #[[ATTR19:[0-9]+]] +; SVE: [[CALL:%.*]] = tail call float @llvm.sin.f32(float [[CONV:%.*]]) #[[ATTR21:[0-9]+]] ; SVE: ret void ; entry: From e8cd401eaefe8113cae4b4f85ee78600925a9481 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Fri, 24 Nov 2023 14:21:45 +0100 Subject: [PATCH 19/35] Remove extraneous ` in AttrDocs.td --- clang/include/clang/Basic/AttrDocs.td | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/include/clang/Basic/AttrDocs.td b/clang/include/clang/Basic/AttrDocs.td index cfd806aa3a029b..be74535e28d8a6 100644 --- a/clang/include/clang/Basic/AttrDocs.td +++ b/clang/include/clang/Basic/AttrDocs.td @@ -7585,7 +7585,7 @@ def CoroLifetimeBoundDoc : Documentation { let Category = DocCatDecl; let Content = [{ The ``[[clang::coro_lifetimebound]]`` is a class attribute which can be applied -to a `coroutine return type (`CRT`_) (i.e. +to a coroutine return type (`CRT`_) (i.e. it should also be annotated with ``[[clang::coro_return_type]]``). All parameters of a function are considered to be lifetime bound. See `documentation`_ From 84f6e1d71c19bccd13a23a008ed815391e4f6b8e Mon Sep 17 00:00:00 2001 From: Jeremy Morse Date: Thu, 16 Nov 2023 15:41:52 +0000 Subject: [PATCH 20/35] [DebugInfo] Clone dbg.values in SimplifyCFG like normal instructions (#72526) The code in the CloneInstructionsIntoPredec... function modified by this patch has a long history that dates back to 2011, see d715ec82b4ad12c59. There, when folding branches, all dbg.value intrinsics seen when folding would be saved and then re-inserted at the end of whatever was folded. Over the last 12 years this behaviour has been preserved. However, IMO it's bad behaviour. If we have: inst1 dbg.value1 inst2 dbg.value2 And we fold that sequence into a different block, then we would want the instructions and variable assignments to appear in the same order. However because of this old behaviour, the dbg.values are sunk, and we get: inst1 inst2 dbg.value1 dbg.value2 This clustering of dbg.values can make assignments to the same variable invisible, as well as reducing the coverage of other assignments. This patch relaxes the CloneInstructions... function and allows it to clone and update dbg.values in-place, causing them to appear in the original order in the destination block. I've added some extra dbg.values to the updated test: without the changes to the pass, the dbg.values sink into a blob ahead of the select. The RemoveDIs code can't cope with this right now so I've removed the "--try..." flag, restored in a commit to land in a couple of hours. (Metadata changes to make the LLVM-IR parser not drop the debug-info for it being out of date. The RemoveDIs related RUN line has been removed because it was spuriously passing due to the debug-info being dropped). --- llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 21 +++++------ .../Transforms/SimplifyCFG/branch-fold-dbg.ll | 35 +++++++++++-------- 2 files changed, 29 insertions(+), 27 deletions(-) diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 4b4d0595cbf776..3bcd896639a8ec 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1101,12 +1101,13 @@ static void CloneInstructionsIntoPredecessorBlockAndUpdateSSAUses( // Note that there may be multiple predecessor blocks, so we cannot move // bonus instructions to a predecessor block. for (Instruction &BonusInst : *BB) { - if (isa(BonusInst) || BonusInst.isTerminator()) + if (BonusInst.isTerminator()) continue; Instruction *NewBonusInst = BonusInst.clone(); - if (PTI->getDebugLoc() != NewBonusInst->getDebugLoc()) { + if (!isa(BonusInst) && + PTI->getDebugLoc() != NewBonusInst->getDebugLoc()) { // Unless the instruction has the same !dbg location as the original // branch, drop it. When we fold the bonus instructions we want to make // sure we reset their debug locations in order to avoid stepping on @@ -1116,7 +1117,6 @@ static void CloneInstructionsIntoPredecessorBlockAndUpdateSSAUses( RemapInstruction(NewBonusInst, VMap, RF_NoModuleLevelChanges | RF_IgnoreMissingLocals); - VMap[&BonusInst] = NewBonusInst; // If we speculated an instruction, we need to drop any metadata that may // result in undefined behavior, as the metadata might have been valid @@ -1126,8 +1126,13 @@ static void CloneInstructionsIntoPredecessorBlockAndUpdateSSAUses( NewBonusInst->dropUBImplyingAttrsAndMetadata(); NewBonusInst->insertInto(PredBlock, PTI->getIterator()); + + if (isa(BonusInst)) + continue; + NewBonusInst->takeName(&BonusInst); BonusInst.setName(NewBonusInst->getName() + ".old"); + VMap[&BonusInst] = NewBonusInst; // Update (liveout) uses of bonus instructions, // now that the bonus instruction has been cloned into predecessor. @@ -3749,16 +3754,6 @@ static bool performBranchToCommonDestFolding(BranchInst *BI, BranchInst *PBI, PBI->setCondition( createLogicalOp(Builder, Opc, PBI->getCondition(), BICond, "or.cond")); - // Copy any debug value intrinsics into the end of PredBlock. - for (Instruction &I : *BB) { - if (isa(I)) { - Instruction *NewI = I.clone(); - RemapInstruction(NewI, VMap, - RF_NoModuleLevelChanges | RF_IgnoreMissingLocals); - NewI->insertBefore(PBI); - } - } - ++NumFoldBranchToCommonDest; return true; } diff --git a/llvm/test/Transforms/SimplifyCFG/branch-fold-dbg.ll b/llvm/test/Transforms/SimplifyCFG/branch-fold-dbg.ll index e754b5187d87e6..e8b8cc6edafe0c 100644 --- a/llvm/test/Transforms/SimplifyCFG/branch-fold-dbg.ll +++ b/llvm/test/Transforms/SimplifyCFG/branch-fold-dbg.ll @@ -1,6 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S < %s | FileCheck %s -; RUN: opt -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S < %s --try-experimental-debuginfo-iterators | FileCheck %s %0 = type { ptr, ptr } @@ -9,23 +8,26 @@ define i1 @foo(i32) nounwind ssp !dbg !0 { ; CHECK-LABEL: @foo( ; CHECK-NEXT: Entry: -; CHECK-NEXT: [[TMP1:%.*]] = icmp slt i32 [[TMP0:%.*]], 0 -; CHECK-NEXT: [[TMP2:%.*]] = icmp sgt i32 [[TMP0]], 4 -; CHECK-NEXT: [[OR_COND:%.*]] = or i1 [[TMP1]], [[TMP2]] -; CHECK-NEXT: br i1 [[OR_COND]], label [[COMMON_RET:%.*]], label [[BB2:%.*]] +; CHECK-NEXT: [[TMP1:%.*]] = icmp slt i32 [[TMP0:%.*]], 0, !dbg [[DBG7:![0-9]+]] +; CHECK-NEXT: [[TMP2:%.*]] = icmp sgt i32 [[TMP0]], 4, !dbg [[DBG7]] +; CHECK-NEXT: [[OR_COND:%.*]] = or i1 [[TMP1]], [[TMP2]], !dbg [[DBG7]] +; CHECK-NEXT: br i1 [[OR_COND]], label [[COMMON_RET:%.*]], label [[BB2:%.*]], !dbg [[DBG7]] ; CHECK: BB2: -; CHECK-NEXT: [[TMP3:%.*]] = shl i32 1, [[TMP0]] -; CHECK-NEXT: [[TMP4:%.*]] = and i32 [[TMP3]], 31 -; CHECK-NEXT: [[TMP5:%.*]] = icmp eq i32 [[TMP4]], 0 +; CHECK-NEXT: [[TMP3:%.*]] = shl i32 1, [[TMP0]], !dbg [[DBG7]] +; CHECK-NEXT: [[TMP4:%.*]] = and i32 [[TMP3]], 31, !dbg [[DBG7]] +; CHECK-NEXT: [[TMP5:%.*]] = icmp eq i32 [[TMP4]], 0, !dbg [[DBG7]] +; CHECK-NEXT: call void @llvm.dbg.value(metadata ptr null, metadata [[META8:![0-9]+]], metadata !DIExpression()), !dbg [[DBG13:![0-9]+]] ; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds [5 x %0], ptr @[[GLOB0:[0-9]+]], i32 0, i32 [[TMP0]] +; CHECK-NEXT: call void @llvm.dbg.value(metadata ptr [[TMP6]], metadata [[META8]], metadata !DIExpression()), !dbg [[DBG13]] ; CHECK-NEXT: [[TMP7:%.*]] = icmp eq ptr [[TMP6]], null -; CHECK-NEXT: [[OR_COND2:%.*]] = select i1 [[TMP5]], i1 true, i1 [[TMP7]] +; CHECK-NEXT: call void @llvm.dbg.value(metadata ptr [[TMP6]], metadata [[META8]], metadata !DIExpression()), !dbg [[DBG13]] +; CHECK-NEXT: [[OR_COND2:%.*]] = select i1 [[TMP5]], i1 true, i1 [[TMP7]], !dbg [[DBG7]] ; CHECK-NEXT: [[TMP8:%.*]] = icmp slt i32 [[TMP0]], 0 -; CHECK-NEXT: [[SPEC_SELECT:%.*]] = select i1 [[OR_COND2]], i1 false, i1 [[TMP8]] -; CHECK-NEXT: br label [[COMMON_RET]] +; CHECK-NEXT: [[SPEC_SELECT:%.*]] = select i1 [[OR_COND2]], i1 false, i1 [[TMP8]], !dbg [[DBG7]] +; CHECK-NEXT: br label [[COMMON_RET]], !dbg [[DBG7]] ; CHECK: common.ret: ; CHECK-NEXT: [[COMMON_RET_OP:%.*]] = phi i1 [ false, [[ENTRY:%.*]] ], [ [[SPEC_SELECT]], [[BB2]] ] -; CHECK-NEXT: ret i1 [[COMMON_RET_OP]] +; CHECK-NEXT: ret i1 [[COMMON_RET_OP]], !dbg [[DBG14:![0-9]+]] ; Entry: %1 = icmp slt i32 %0, 0, !dbg !5 @@ -43,9 +45,11 @@ BB2: ; preds = %BB1 BB3: ; preds = %BB2 + call void @llvm.dbg.value(metadata ptr null, metadata !7, metadata !DIExpression()), !dbg !12 %6 = getelementptr inbounds [5 x %0], ptr @0, i32 0, i32 %0, !dbg !6 - call void @llvm.dbg.value(metadata ptr %6, metadata !7, metadata !{}), !dbg !12 + call void @llvm.dbg.value(metadata ptr %6, metadata !7, metadata !DIExpression()), !dbg !12 %7 = icmp eq ptr %6, null, !dbg !13 + call void @llvm.dbg.value(metadata ptr %6, metadata !7, metadata !DIExpression()), !dbg !12 br i1 %7, label %BB5, label %BB4, !dbg !13 BB4: ; preds = %BB3 @@ -59,12 +63,13 @@ BB5: ; preds = %BB3, %BB2, %BB1, %E declare void @llvm.dbg.value(metadata, metadata, metadata) nounwind readnone !llvm.dbg.cu = !{!2} +!llvm.module.flags = !{!16, !17} !0 = distinct !DISubprogram(name: "foo", line: 231, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !2, file: !15, scope: !1, type: !3) !1 = !DIFile(filename: "a.c", directory: "/private/tmp") !2 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang (trunk 129006)", isOptimized: true, emissionKind: FullDebug, file: !15, enums: !4, retainedTypes: !4) !3 = !DISubroutineType(types: !4) -!4 = !{null} +!4 = !{} !5 = !DILocation(line: 131, column: 2, scope: !0) !6 = !DILocation(line: 134, column: 2, scope: !0) !7 = !DILocalVariable(name: "bar", line: 232, scope: !8, file: !1, type: !9) @@ -76,3 +81,5 @@ declare void @llvm.dbg.value(metadata, metadata, metadata) nounwind readnone !13 = !DILocation(line: 234, column: 2, scope: !8) !14 = !DILocation(line: 274, column: 1, scope: !8) !15 = !DIFile(filename: "a.c", directory: "/private/tmp") +!16 = !{i32 1, !"Debug Info Version", i32 3} +!17 = !{i32 2, !"Dwarf Version", i32 4} From dc9787c87223540a6058aa1d0f647d6b0e1c53c7 Mon Sep 17 00:00:00 2001 From: Guillaume Chatelet Date: Fri, 24 Nov 2023 14:33:19 +0100 Subject: [PATCH 21/35] [libc][NFC] Remove dead code (#73315) --- libc/src/__support/FPUtil/FloatProperties.h | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/libc/src/__support/FPUtil/FloatProperties.h b/libc/src/__support/FPUtil/FloatProperties.h index 3be4b518be3384..35d6a14a9d3237 100644 --- a/libc/src/__support/FPUtil/FloatProperties.h +++ b/libc/src/__support/FPUtil/FloatProperties.h @@ -218,24 +218,6 @@ template <> struct FloatProperties { }; #endif // LIBC_COMPILER_HAS_FLOAT128 -// Define the float type corresponding to the BitsType. -template struct FloatType; - -template <> struct FloatType { - static_assert(sizeof(uint32_t) == sizeof(float), - "Unexpected size of 'float' type."); - typedef float Type; -}; - -template <> struct FloatType { - static_assert(sizeof(uint64_t) == sizeof(double), - "Unexpected size of 'double' type."); - typedef double Type; -}; - -template -using FloatTypeT = typename FloatType::Type; - } // namespace fputil } // namespace LIBC_NAMESPACE From 3d8a9105d7e0e4baa744428e55d1c2462803118a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?= Date: Fri, 24 Nov 2023 14:35:10 +0100 Subject: [PATCH 22/35] [clang][ASTImporter] Fix import of SubstTemplateTypeParmType in return type of function. (#69724) Import of a function with `auto` return type that is expanded to a `SubstTemplateTypeParmType` could fail if the function itself is the template specialization where the parameter was replaced. --- clang/lib/AST/ASTImporter.cpp | 10 ++++++++++ clang/unittests/AST/ASTImporterTest.cpp | 23 ++++++++++++++++++++--- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index c4e931e220f69b..3dc33c10af11ed 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -3513,6 +3513,14 @@ class IsTypeDeclaredInsideVisitor return {}; } + std::optional + VisitSubstTemplateTypeParmType(const SubstTemplateTypeParmType *T) { + // The "associated declaration" can be the same as ParentDC. + if (isAncestorDeclContextOf(ParentDC, T->getAssociatedDecl())) + return true; + return {}; + } + std::optional VisitConstantArrayType(const ConstantArrayType *T) { if (T->getSizeExpr() && isAncestorDeclContextOf(ParentDC, T->getSizeExpr())) return true; @@ -3573,6 +3581,8 @@ class IsTypeDeclaredInsideVisitor }; } // namespace +/// This function checks if the function has 'auto' return type that contains +/// a reference (in any way) to a declaration inside the same function. bool ASTNodeImporter::hasAutoReturnTypeDeclaredInside(FunctionDecl *D) { QualType FromTy = D->getType(); const auto *FromFPT = FromTy->getAs(); diff --git a/clang/unittests/AST/ASTImporterTest.cpp b/clang/unittests/AST/ASTImporterTest.cpp index 5f4d8d040772cb..902b740a5106c0 100644 --- a/clang/unittests/AST/ASTImporterTest.cpp +++ b/clang/unittests/AST/ASTImporterTest.cpp @@ -6790,10 +6790,13 @@ TEST_P(ASTImporterOptionSpecificTestBase, } struct ImportAutoFunctions : ASTImporterOptionSpecificTestBase { - void testImport(llvm::StringRef Code, clang::TestLanguage Lang = Lang_CXX14) { + void testImport(llvm::StringRef Code, clang::TestLanguage Lang = Lang_CXX14, + bool FindLast = false) { Decl *FromTU = getTuDecl(Code, Lang, "input0.cc"); - FunctionDecl *From = FirstDeclMatcher().match( - FromTU, functionDecl(hasName("foo"))); + FunctionDecl *From = FindLast ? LastDeclMatcher().match( + FromTU, functionDecl(hasName("foo"))) + : FirstDeclMatcher().match( + FromTU, functionDecl(hasName("foo"))); FunctionDecl *To = Import(From, Lang); EXPECT_TRUE(To); @@ -7232,6 +7235,20 @@ TEST_P(ImportAutoFunctions, ReturnWithTypeInSwitch) { Lang_CXX17); } +TEST_P(ImportAutoFunctions, ReturnWithAutoTemplateType) { + testImport( + R"( + template + struct S {}; + template + auto foo() { + return S{}; + } + auto a = foo(); + )", + Lang_CXX14, /*FindLast=*/true); +} + struct ImportSourceLocations : ASTImporterOptionSpecificTestBase {}; TEST_P(ImportSourceLocations, PreserveFileIDTreeStructure) { From a79a5611bd18baab02ea6ad31f7b6b767f4028a7 Mon Sep 17 00:00:00 2001 From: Timm Baeder Date: Fri, 24 Nov 2023 14:40:58 +0100 Subject: [PATCH 23/35] [clang] Classify vector types in __builtin_classify_type (#73299) --- clang/docs/ReleaseNotes.rst | 4 ++-- clang/lib/AST/ExprConstShared.h | 3 ++- clang/lib/AST/ExprConstant.cpp | 8 +++++--- clang/test/Sema/builtin-classify-type.c | 6 +++--- clang/test/SemaCXX/builtin-classify-type.cpp | 6 +++--- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 7e2c990d03e7f2..362ce410356719 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -225,8 +225,8 @@ Non-comprehensive list of changes in this release determined at runtime. * The ``__datasizeof`` keyword has been added. It is similar to ``sizeof`` except that it returns the size of a type ignoring tail padding. -* ``__builtin_classify_type()`` now classifies ``_BitInt`` values as the return value ``18``, - to match GCC 14's behavior. +* ``__builtin_classify_type()`` now classifies ``_BitInt`` values as the return value ``18`` + and vector types as return value ``19``, to match GCC 14's behavior. New Compiler Flags ------------------ diff --git a/clang/lib/AST/ExprConstShared.h b/clang/lib/AST/ExprConstShared.h index 53ec9c6c7a3ef2..a97eac85abc69e 100644 --- a/clang/lib/AST/ExprConstShared.h +++ b/clang/lib/AST/ExprConstShared.h @@ -49,7 +49,8 @@ enum class GCCTypeClass { // literals. // Lang = 16, // OpaqueType = 17, - BitInt = 18 + BitInt = 18, + Vector = 19 }; GCCTypeClass EvaluateBuiltinClassifyType(QualType T, diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 3a41e9718bb587..16697e5f076a8f 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -11615,16 +11615,18 @@ GCCTypeClass EvaluateBuiltinClassifyType(QualType T, return EvaluateBuiltinClassifyType( CanTy->castAs()->getValueType(), LangOpts); - case Type::BlockPointer: case Type::Vector: case Type::ExtVector: + return GCCTypeClass::Vector; + + case Type::BlockPointer: case Type::ConstantMatrix: case Type::ObjCObject: case Type::ObjCInterface: case Type::ObjCObjectPointer: case Type::Pipe: - // GCC classifies vectors as None. We follow its lead and classify all - // other types that don't fit into the regular classification the same way. + // Classify all other types that don't fit into the regular + // classification the same way. return GCCTypeClass::None; case Type::BitInt: diff --git a/clang/test/Sema/builtin-classify-type.c b/clang/test/Sema/builtin-classify-type.c index 50f517fcbc852a..21b212faeedcd8 100644 --- a/clang/test/Sema/builtin-classify-type.c +++ b/clang/test/Sema/builtin-classify-type.c @@ -13,7 +13,7 @@ enum gcc_type_class { record_type_class, union_type_class, array_type_class, string_type_class, lang_type_class, opaque_type_class, - bitint_type_class + bitint_type_class, vector_type_class }; void foo(void) { @@ -67,8 +67,8 @@ void foo(void) { int a11[__builtin_classify_type(arr) == pointer_type_class ? 1 : -1]; int a12[__builtin_classify_type("abc") == pointer_type_class ? 1 : -1]; int a13[__builtin_classify_type(block) == no_type_class ? 1 : -1]; - int a14[__builtin_classify_type(vec) == no_type_class ? 1 : -1]; - int a15[__builtin_classify_type(evec) == no_type_class ? 1 : -1]; + int a14[__builtin_classify_type(vec) == vector_type_class ? 1 : -1]; + int a15[__builtin_classify_type(evec) == vector_type_class ? 1 : -1]; int a16[__builtin_classify_type(atomic_i) == integer_type_class ? 1 : -1]; int a17[__builtin_classify_type(atomic_d) == real_type_class ? 1 : -1]; int a18[__builtin_classify_type(complex_i) == complex_type_class ? 1 : -1]; diff --git a/clang/test/SemaCXX/builtin-classify-type.cpp b/clang/test/SemaCXX/builtin-classify-type.cpp index 651dc8b24bf948..6bae9cd6b1dc0d 100644 --- a/clang/test/SemaCXX/builtin-classify-type.cpp +++ b/clang/test/SemaCXX/builtin-classify-type.cpp @@ -13,7 +13,7 @@ enum gcc_type_class { record_type_class, union_type_class, array_type_class, string_type_class, lang_type_class, opaque_type_class, - bitint_type_class + bitint_type_class, vector_type_class }; class cl { @@ -62,8 +62,8 @@ void foo() { int a14[__builtin_classify_type(arr) == pointer_type_class ? 1 : -1]; int a15[__builtin_classify_type("abc") == pointer_type_class ? 1 : -1]; int a16[__builtin_classify_type(block) == no_type_class ? 1 : -1]; - int a17[__builtin_classify_type(vec) == no_type_class ? 1 : -1]; - int a18[__builtin_classify_type(evec) == no_type_class ? 1 : -1]; + int a17[__builtin_classify_type(vec) == vector_type_class ? 1 : -1]; + int a18[__builtin_classify_type(evec) == vector_type_class ? 1 : -1]; int a19[__builtin_classify_type(atomic_i) == integer_type_class ? 1 : -1]; int a20[__builtin_classify_type(atomic_d) == real_type_class ? 1 : -1]; int a21[__builtin_classify_type(complex_i) == complex_type_class ? 1 : -1]; From 7eeedc124f9901a65573668bc504a45111a3f837 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 24 Nov 2023 14:35:26 +0100 Subject: [PATCH 24/35] [CodeGen] Make some includes explicit (NFC) Explicitly include some headers or forward-declare types, in preparation for removing an include that pulls in many transitive headers. --- llvm/include/llvm/CodeGen/MIRFormatter.h | 4 ++++ llvm/include/llvm/CodeGen/MIRParser/MIParser.h | 2 ++ llvm/include/llvm/CodeGen/MachineMemOperand.h | 2 ++ llvm/include/llvm/CodeGen/ModuloSchedule.h | 1 + llvm/include/llvm/CodeGen/TargetFrameLowering.h | 1 + llvm/lib/CodeGen/LiveDebugVariables.cpp | 1 + llvm/lib/Target/AArch64/AArch64SIMDInstrOpt.cpp | 1 + llvm/lib/Target/AArch64/GISel/AArch64RegisterBankInfo.cpp | 1 + llvm/lib/Target/AMDGPU/SIRegisterInfo.h | 2 ++ llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp | 1 + llvm/lib/Target/Hexagon/HexagonExpandCondsets.cpp | 1 + 11 files changed, 17 insertions(+) diff --git a/llvm/include/llvm/CodeGen/MIRFormatter.h b/llvm/include/llvm/CodeGen/MIRFormatter.h index 203d965836f65c..42087f549426b7 100644 --- a/llvm/include/llvm/CodeGen/MIRFormatter.h +++ b/llvm/include/llvm/CodeGen/MIRFormatter.h @@ -14,6 +14,7 @@ #define LLVM_CODEGEN_MIRFORMATTER_H #include "llvm/CodeGen/PseudoSourceValue.h" +#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" #include #include @@ -22,7 +23,10 @@ namespace llvm { class MachineFunction; class MachineInstr; +class ModuleSlotTracker; struct PerFunctionMIParsingState; +class Twine; +class Value; /// MIRFormater - Interface to format MIR operand based on target class MIRFormatter { diff --git a/llvm/include/llvm/CodeGen/MIRParser/MIParser.h b/llvm/include/llvm/CodeGen/MIRParser/MIParser.h index b01a0c7aa073ca..7fd9d99ded6995 100644 --- a/llvm/include/llvm/CodeGen/MIRParser/MIParser.h +++ b/llvm/include/llvm/CodeGen/MIRParser/MIParser.h @@ -17,8 +17,10 @@ #include "llvm/ADT/StringMap.h" #include "llvm/CodeGen/MachineMemOperand.h" #include "llvm/CodeGen/Register.h" +#include "llvm/IR/TrackingMDRef.h" #include "llvm/Support/Allocator.h" #include "llvm/Support/SMLoc.h" +#include #include namespace llvm { diff --git a/llvm/include/llvm/CodeGen/MachineMemOperand.h b/llvm/include/llvm/CodeGen/MachineMemOperand.h index da7fd7cdf02958..5bfa7ffa65d519 100644 --- a/llvm/include/llvm/CodeGen/MachineMemOperand.h +++ b/llvm/include/llvm/CodeGen/MachineMemOperand.h @@ -20,6 +20,8 @@ #include "llvm/CodeGen/LowLevelType.h" #include "llvm/CodeGen/PseudoSourceValue.h" #include "llvm/IR/DerivedTypes.h" +#include "llvm/IR/LLVMContext.h" +#include "llvm/IR/Metadata.h" #include "llvm/IR/Value.h" // PointerLikeTypeTraits #include "llvm/Support/AtomicOrdering.h" #include "llvm/Support/DataTypes.h" diff --git a/llvm/include/llvm/CodeGen/ModuloSchedule.h b/llvm/include/llvm/CodeGen/ModuloSchedule.h index d03f7b4959159e..fd424163f0d19b 100644 --- a/llvm/include/llvm/CodeGen/ModuloSchedule.h +++ b/llvm/include/llvm/CodeGen/ModuloSchedule.h @@ -65,6 +65,7 @@ #include "llvm/CodeGen/TargetInstrInfo.h" #include "llvm/CodeGen/TargetSubtargetInfo.h" #include +#include #include namespace llvm { diff --git a/llvm/include/llvm/CodeGen/TargetFrameLowering.h b/llvm/include/llvm/CodeGen/TargetFrameLowering.h index 35551d45af43ab..0b9cacecc7cbe1 100644 --- a/llvm/include/llvm/CodeGen/TargetFrameLowering.h +++ b/llvm/include/llvm/CodeGen/TargetFrameLowering.h @@ -13,6 +13,7 @@ #ifndef LLVM_CODEGEN_TARGETFRAMELOWERING_H #define LLVM_CODEGEN_TARGETFRAMELOWERING_H +#include "llvm/ADT/BitVector.h" #include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/Support/TypeSize.h" #include diff --git a/llvm/lib/CodeGen/LiveDebugVariables.cpp b/llvm/lib/CodeGen/LiveDebugVariables.cpp index 9603c1f01e0856..7cb90af5ff173e 100644 --- a/llvm/lib/CodeGen/LiveDebugVariables.cpp +++ b/llvm/lib/CodeGen/LiveDebugVariables.cpp @@ -58,6 +58,7 @@ #include #include #include +#include #include #include #include diff --git a/llvm/lib/Target/AArch64/AArch64SIMDInstrOpt.cpp b/llvm/lib/Target/AArch64/AArch64SIMDInstrOpt.cpp index 8b45109d976ae6..5e89a531f7e861 100644 --- a/llvm/lib/Target/AArch64/AArch64SIMDInstrOpt.cpp +++ b/llvm/lib/Target/AArch64/AArch64SIMDInstrOpt.cpp @@ -50,6 +50,7 @@ #include "llvm/MC/MCSchedule.h" #include "llvm/Pass.h" #include +#include using namespace llvm; diff --git a/llvm/lib/Target/AArch64/GISel/AArch64RegisterBankInfo.cpp b/llvm/lib/Target/AArch64/GISel/AArch64RegisterBankInfo.cpp index 323e5cf282744a..3284d0f033e3b4 100644 --- a/llvm/lib/Target/AArch64/GISel/AArch64RegisterBankInfo.cpp +++ b/llvm/lib/Target/AArch64/GISel/AArch64RegisterBankInfo.cpp @@ -30,6 +30,7 @@ #include "llvm/CodeGen/TargetSubtargetInfo.h" #include "llvm/IR/IntrinsicsAArch64.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/Threading.h" #include #include diff --git a/llvm/lib/Target/AMDGPU/SIRegisterInfo.h b/llvm/lib/Target/AMDGPU/SIRegisterInfo.h index 14fa91a715e198..88d5686720985e 100644 --- a/llvm/lib/Target/AMDGPU/SIRegisterInfo.h +++ b/llvm/lib/Target/AMDGPU/SIRegisterInfo.h @@ -14,6 +14,8 @@ #ifndef LLVM_LIB_TARGET_AMDGPU_SIREGISTERINFO_H #define LLVM_LIB_TARGET_AMDGPU_SIREGISTERINFO_H +#include "llvm/ADT/BitVector.h" + #define GET_REGINFO_HEADER #include "AMDGPUGenRegisterInfo.inc" diff --git a/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp b/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp index 06ed9defc59be4..1895d15c1f5533 100644 --- a/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp +++ b/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp @@ -89,6 +89,7 @@ #include "llvm/IR/Type.h" #include "llvm/IR/User.h" #include "llvm/IR/Value.h" +#include "llvm/IR/ValueHandle.h" #include "llvm/Pass.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" #include diff --git a/llvm/lib/Target/Hexagon/HexagonExpandCondsets.cpp b/llvm/lib/Target/Hexagon/HexagonExpandCondsets.cpp index 7dc154aaaea1a6..e1005296d63752 100644 --- a/llvm/lib/Target/Hexagon/HexagonExpandCondsets.cpp +++ b/llvm/lib/Target/Hexagon/HexagonExpandCondsets.cpp @@ -115,6 +115,7 @@ #include "llvm/Support/raw_ostream.h" #include #include +#include #include #include From c8562e81bce36f45f03ba059a58c3a1762a77ebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= Date: Wed, 18 Oct 2023 14:27:51 +0200 Subject: [PATCH 25/35] [llvm-jitlink] Avoid assertion failure in make_error parameter If GOTSym is not defined, we cannot call `GOTSym.getBlock()`. It failed with: ``` Assertion failed: (Base->isDefined() && "Not a defined symbol"), function getBlock, file JITLink.h, line 554. ``` --- llvm/tools/llvm-jitlink/llvm-jitlink-elf.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/llvm/tools/llvm-jitlink/llvm-jitlink-elf.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink-elf.cpp index 7881660d1a7385..4b7b3f9be70178 100644 --- a/llvm/tools/llvm-jitlink/llvm-jitlink-elf.cpp +++ b/llvm/tools/llvm-jitlink/llvm-jitlink-elf.cpp @@ -55,7 +55,11 @@ static Expected getELFStubTarget(LinkGraph &G, Block &B) { if (!E) return E.takeError(); auto &GOTSym = E->getTarget(); - if (!GOTSym.isDefined() || !isELFGOTSection(GOTSym.getBlock().getSection())) + if (!GOTSym.isDefined()) + return make_error("Stubs entry in " + G.getName() + + " does not point to GOT entry", + inconvertibleErrorCode()); + if (!isELFGOTSection(GOTSym.getBlock().getSection())) return make_error( "Stubs entry in " + G.getName() + ", \"" + GOTSym.getBlock().getSection().getName() + From 962829bdb342d5dc9998a9f146146608812a832b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= Date: Wed, 18 Oct 2023 14:30:11 +0200 Subject: [PATCH 26/35] [JITLink] Fix typos: symobls -> symbols (NFC) --- llvm/include/llvm-c/Orc.h | 2 +- llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h | 2 +- llvm/include/llvm/ExecutionEngine/JITLink/aarch64.h | 2 +- llvm/include/llvm/ExecutionEngine/JITLink/loongarch.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/llvm/include/llvm-c/Orc.h b/llvm/include/llvm-c/Orc.h index 9a57c2edfd545b..304833cca2d433 100644 --- a/llvm/include/llvm-c/Orc.h +++ b/llvm/include/llvm-c/Orc.h @@ -346,7 +346,7 @@ typedef struct LLVMOrcOpaqueLookupState *LLVMOrcLookupStateRef; * into. * * The JDLookupFlags argument can be inspected to determine whether the original - * lookup included non-exported symobls. + * lookup included non-exported symbols. * * Finally, the LookupSet argument contains the set of symbols that could not * be found in JD already (the set of generation candidates). diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h index fb758f7a66cf55..8a019492c12d59 100644 --- a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h +++ b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h @@ -1862,7 +1862,7 @@ Error makeAlignmentError(llvm::orc::ExecutorAddr Loc, uint64_t Value, int N, const Edge &E); /// Creates a new pointer block in the given section and returns an -/// Anonymous symobl pointing to it. +/// Anonymous symbol pointing to it. /// /// The pointer block will have the following default values: /// alignment: PointerSize diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/aarch64.h b/llvm/include/llvm/ExecutionEngine/JITLink/aarch64.h index 8d3f29b545f21a..27a90ebef3d6d6 100644 --- a/llvm/include/llvm/ExecutionEngine/JITLink/aarch64.h +++ b/llvm/include/llvm/ExecutionEngine/JITLink/aarch64.h @@ -618,7 +618,7 @@ extern const char NullPointerContent[PointerSize]; extern const char PointerJumpStubContent[12]; /// Creates a new pointer block in the given section and returns an -/// Anonymous symobl pointing to it. +/// Anonymous symbol pointing to it. /// /// If InitialTarget is given then an Pointer64 relocation will be added to the /// block pointing at InitialTarget. diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/loongarch.h b/llvm/include/llvm/ExecutionEngine/JITLink/loongarch.h index bec657723a38cf..26351ed9971cc4 100644 --- a/llvm/include/llvm/ExecutionEngine/JITLink/loongarch.h +++ b/llvm/include/llvm/ExecutionEngine/JITLink/loongarch.h @@ -280,7 +280,7 @@ inline ArrayRef getStubBlockContent(LinkGraph &G) { } /// Creates a new pointer block in the given section and returns an -/// Anonymous symobl pointing to it. +/// Anonymous symbol pointing to it. /// /// If InitialTarget is given then an Pointer64 relocation will be added to the /// block pointing at InitialTarget. From 820b3583c9681a1969814ac3b04a6fe41b87d079 Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Fri, 24 Nov 2023 14:14:49 +0000 Subject: [PATCH 27/35] [AArch64] Add artificial clobbers to swift async context test. Manually add clobbers for various register combinations to tests. This highlights incorrectly performing shrink-wrapping, with StoreSwiftAsyncContext expansion clobbering a live register. --- ...re-swift-async-context-clobber-live-reg.ll | 261 +++++++++++++++--- 1 file changed, 227 insertions(+), 34 deletions(-) diff --git a/llvm/test/CodeGen/AArch64/store-swift-async-context-clobber-live-reg.ll b/llvm/test/CodeGen/AArch64/store-swift-async-context-clobber-live-reg.ll index 832e2a6eae74fc..f81531766ca13b 100644 --- a/llvm/test/CodeGen/AArch64/store-swift-async-context-clobber-live-reg.ll +++ b/llvm/test/CodeGen/AArch64/store-swift-async-context-clobber-live-reg.ll @@ -1,42 +1,11 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4 -; RUN: llc -o - -mtriple=arm64e-apple-macosx %s | FileCheck %s +; RUN: not --crash llc -o - -mtriple=arm64e-apple-macosx -aarch64-min-jump-table-entries=2 %s target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" -define swifttailcc void @test_async_with_jumptable(ptr %src, ptr swiftasync %as) #0 { -; CHECK-LABEL: test_async_with_jumptable: -; CHECK: ; %bb.0: ; %entry -; CHECK-NEXT: orr x29, x29, #0x1000000000000000 -; CHECK-NEXT: str x19, [sp, #-32]! ; 8-byte Folded Spill -; CHECK-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill -; CHECK-NEXT: add x16, sp, #8 -; CHECK-NEXT: movk x16, #49946, lsl #48 -; CHECK-NEXT: mov x17, x22 -; CHECK-NEXT: pacdb x17, x16 -; CHECK-NEXT: str x17, [sp, #8] -; CHECK-NEXT: add x29, sp, #16 -; CHECK-NEXT: .cfi_def_cfa w29, 16 -; CHECK-NEXT: .cfi_offset w30, -8 -; CHECK-NEXT: .cfi_offset w29, -16 -; CHECK-NEXT: .cfi_offset w19, -32 -; CHECK-NEXT: mov x20, x22 -; CHECK-NEXT: ldr x8, [x0] -; CHECK-NEXT: cmp x8, #2 -; CHECK-NEXT: csel x9, xzr, x0, eq -; CHECK-NEXT: cmp x8, #0 -; CHECK-NEXT: csel x10, x22, xzr, eq -; CHECK-NEXT: cmp x8, #1 -; CHECK-NEXT: csel x19, x9, x10, gt -; CHECK-NEXT: mov x22, x0 -; CHECK-NEXT: bl _foo -; CHECK-NEXT: mov x2, x0 -; CHECK-NEXT: mov x0, x19 -; CHECK-NEXT: mov x1, x20 -; CHECK-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload -; CHECK-NEXT: ldr x19, [sp], #32 ; 8-byte Folded Reload -; CHECK-NEXT: and x29, x29, #0xefffffffffffffff -; CHECK-NEXT: br x2 +define swifttailcc void @test_async_with_jumptable_x16_clobbered(ptr %src, ptr swiftasync %as) #0 { entry: + %x16 = tail call i64 asm "", "={x16}"() %l = load i64, ptr %src, align 8 switch i64 %l, label %dead [ i64 0, label %exit @@ -59,6 +28,230 @@ dead: ; preds = %entryresume.5 exit: %p = phi ptr [ %src, %then.3 ], [ null, %then.2 ], [ %as, %entry ], [ null, %then.1 ] + tail call void asm sideeffect "", "{x16}"(i64 %x16) + %r = call i64 @foo() + %fn = inttoptr i64 %r to ptr + musttail call swifttailcc void %fn(ptr swiftasync %src, ptr %p, ptr %as) + ret void +} + +define swifttailcc void @test_async_with_jumptable_x17_clobbered(ptr %src, ptr swiftasync %as) #0 { +entry: + %x17 = tail call i64 asm "", "={x17}"() + %l = load i64, ptr %src, align 8 + switch i64 %l, label %dead [ + i64 0, label %exit + i64 1, label %then.1 + i64 2, label %then.2 + i64 3, label %then.3 + ] + +then.1: + br label %exit + +then.2: + br label %exit + +then.3: + br label %exit + +dead: ; preds = %entryresume.5 + unreachable + +exit: + %p = phi ptr [ %src, %then.3 ], [ null, %then.2 ], [ %as, %entry ], [ null, %then.1 ] + tail call void asm sideeffect "", "{x17}"(i64 %x17) + %r = call i64 @foo() + %fn = inttoptr i64 %r to ptr + musttail call swifttailcc void %fn(ptr swiftasync %src, ptr %p, ptr %as) + ret void +} + +define swifttailcc void @test_async_with_jumptable_x1_clobbered(ptr %src, ptr swiftasync %as) #0 { +entry: + %x1 = tail call i64 asm "", "={x1}"() + %l = load i64, ptr %src, align 8 + switch i64 %l, label %dead [ + i64 0, label %exit + i64 1, label %then.1 + i64 2, label %then.2 + i64 3, label %then.3 + ] + +then.1: + br label %exit + +then.2: + br label %exit + +then.3: + br label %exit + +dead: ; preds = %entryresume.5 + unreachable + +exit: + %p = phi ptr [ %src, %then.3 ], [ null, %then.2 ], [ %as, %entry ], [ null, %then.1 ] + tail call void asm sideeffect "", "{x1}"(i64 %x1) + %r = call i64 @foo() + %fn = inttoptr i64 %r to ptr + musttail call swifttailcc void %fn(ptr swiftasync %src, ptr %p, ptr %as) + ret void +} + +define swifttailcc void @test_async_with_jumptable_x1_x9_clobbered(ptr %src, ptr swiftasync %as) #0 { +entry: + %x1 = tail call i64 asm "", "={x1}"() + %x9 = tail call i64 asm "", "={x9}"() + %l = load i64, ptr %src, align 8 + switch i64 %l, label %dead [ + i64 0, label %exit + i64 1, label %then.1 + i64 2, label %then.2 + i64 3, label %then.3 + ] + +then.1: + br label %exit + +then.2: + br label %exit + +then.3: + br label %exit + +dead: ; preds = %entryresume.5 + unreachable + +exit: + %p = phi ptr [ %src, %then.3 ], [ null, %then.2 ], [ %as, %entry ], [ null, %then.1 ] + tail call void asm sideeffect "", "{x1}"(i64 %x1) + tail call void asm sideeffect "", "{x9}"(i64 %x9) + %r = call i64 @foo() + %fn = inttoptr i64 %r to ptr + musttail call swifttailcc void %fn(ptr swiftasync %src, ptr %p, ptr %as) + ret void +} + +; There are 2 available scratch registers left, shrink-wrapping can happen. +define swifttailcc void @test_async_with_jumptable_2_available_regs_left(ptr %src, ptr swiftasync %as) #0 { +entry: + %x1 = tail call i64 asm "", "={x1}"() + %x2 = tail call i64 asm "", "={x2}"() + %x3 = tail call i64 asm "", "={x3}"() + %x4 = tail call i64 asm "", "={x4}"() + %x5 = tail call i64 asm "", "={x5}"() + %x6 = tail call i64 asm "", "={x6}"() + %x7 = tail call i64 asm "", "={x7}"() + %x8 = tail call i64 asm "", "={x8}"() + %x9 = tail call i64 asm "", "={x9}"() + %x11 = tail call i64 asm "", "={x11}"() + %x12 = tail call i64 asm "", "={x12}"() + %x13 = tail call i64 asm "", "={x13}"() + %x14 = tail call i64 asm "", "={x14}"() + %x15 = tail call i64 asm "", "={x15}"() + %x16 = tail call i64 asm "", "={x16}"() + %l = load i64, ptr %src, align 8 + switch i64 %l, label %dead [ + i64 0, label %exit + i64 1, label %then.1 + i64 2, label %then.2 + i64 3, label %then.3 + ] + +then.1: + br label %exit + +then.2: + br label %exit + +then.3: + br label %exit + +dead: ; preds = %entryresume.5 + unreachable + +exit: + %p = phi ptr [ %src, %then.3 ], [ null, %then.2 ], [ %as, %entry ], [ null, %then.1 ] + tail call void asm sideeffect "", "{x1}"(i64 %x1) + tail call void asm sideeffect "", "{x2}"(i64 %x2) + tail call void asm sideeffect "", "{x3}"(i64 %x3) + tail call void asm sideeffect "", "{x4}"(i64 %x4) + tail call void asm sideeffect "", "{x5}"(i64 %x5) + tail call void asm sideeffect "", "{x6}"(i64 %x6) + tail call void asm sideeffect "", "{x7}"(i64 %x7) + tail call void asm sideeffect "", "{x8}"(i64 %x8) + tail call void asm sideeffect "", "{x9}"(i64 %x9) + tail call void asm sideeffect "", "{x11}"(i64 %x11) + tail call void asm sideeffect "", "{x12}"(i64 %x12) + tail call void asm sideeffect "", "{x13}"(i64 %x13) + tail call void asm sideeffect "", "{x14}"(i64 %x14) + tail call void asm sideeffect "", "{x15}"(i64 %x15) + tail call void asm sideeffect "", "{x16}"(i64 %x16) + %r = call i64 @foo() + %fn = inttoptr i64 %r to ptr + musttail call swifttailcc void %fn(ptr swiftasync %src, ptr %p, ptr %as) + ret void +} + +; There is only 1 available scratch registers left, shrink-wrapping cannot +; happen because StoreSwiftAsyncContext needs 2 free scratch registers. +define swifttailcc void @test_async_with_jumptable_1_available_reg_left(ptr %src, ptr swiftasync %as) #0 { +entry: + %x1 = tail call i64 asm "", "={x1}"() + %x2 = tail call i64 asm "", "={x2}"() + %x3 = tail call i64 asm "", "={x3}"() + %x4 = tail call i64 asm "", "={x4}"() + %x5 = tail call i64 asm "", "={x5}"() + %x6 = tail call i64 asm "", "={x6}"() + %x7 = tail call i64 asm "", "={x7}"() + %x8 = tail call i64 asm "", "={x8}"() + %x9 = tail call i64 asm "", "={x9}"() + %x11 = tail call i64 asm "", "={x11}"() + %x12 = tail call i64 asm "", "={x12}"() + %x13 = tail call i64 asm "", "={x13}"() + %x14 = tail call i64 asm "", "={x14}"() + %x15 = tail call i64 asm "", "={x15}"() + %x16 = tail call i64 asm "", "={x16}"() + %x17 = tail call i64 asm "", "={x17}"() + %l = load i64, ptr %src, align 8 + switch i64 %l, label %dead [ + i64 0, label %exit + i64 1, label %then.1 + i64 2, label %then.2 + i64 3, label %then.3 + ] + +then.1: + br label %exit + +then.2: + br label %exit + +then.3: + br label %exit + +dead: ; preds = %entryresume.5 + unreachable + +exit: + %p = phi ptr [ %src, %then.3 ], [ null, %then.2 ], [ %as, %entry ], [ null, %then.1 ] + tail call void asm sideeffect "", "{x1}"(i64 %x1) + tail call void asm sideeffect "", "{x2}"(i64 %x2) + tail call void asm sideeffect "", "{x3}"(i64 %x3) + tail call void asm sideeffect "", "{x4}"(i64 %x4) + tail call void asm sideeffect "", "{x5}"(i64 %x5) + tail call void asm sideeffect "", "{x6}"(i64 %x6) + tail call void asm sideeffect "", "{x7}"(i64 %x7) + tail call void asm sideeffect "", "{x8}"(i64 %x8) + tail call void asm sideeffect "", "{x9}"(i64 %x9) + tail call void asm sideeffect "", "{x11}"(i64 %x11) + tail call void asm sideeffect "", "{x12}"(i64 %x12) + tail call void asm sideeffect "", "{x13}"(i64 %x13) + tail call void asm sideeffect "", "{x14}"(i64 %x14) + tail call void asm sideeffect "", "{x15}"(i64 %x15) + tail call void asm sideeffect "", "{x16}"(i64 %x16) + tail call void asm sideeffect "", "{x17}"(i64 %x17) %r = call i64 @foo() %fn = inttoptr i64 %r to ptr musttail call swifttailcc void %fn(ptr swiftasync %src, ptr %p, ptr %as) From 85ee351aa7b1112b1b9ac2e0ead547e9af8712b5 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 24 Nov 2023 06:44:49 -0800 Subject: [PATCH 28/35] [CI] Skip libcxx in non-llvm repo (#73282) The new libcxx workflow are run and failing in non llvm repo. Skip it similar to other workflow. --- .github/workflows/libcxx-build-and-test.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/libcxx-build-and-test.yaml b/.github/workflows/libcxx-build-and-test.yaml index 905906a1c75c93..dccfe54d464676 100644 --- a/.github/workflows/libcxx-build-and-test.yaml +++ b/.github/workflows/libcxx-build-and-test.yaml @@ -43,6 +43,7 @@ env: jobs: stage1: + if: github.repository_owner == 'llvm' runs-on: group: libcxx-runners-8 continue-on-error: false @@ -81,6 +82,7 @@ jobs: **/CMakeOutput.log **/crash_diagnostics/* stage2: + if: github.repository_owner == 'llvm' runs-on: group: libcxx-runners-8 needs: [ stage1 ] @@ -130,6 +132,7 @@ jobs: **/CMakeOutput.log **/crash_diagnostics/* stage3: + if: github.repository_owner == 'llvm' needs: [ stage1, stage2 ] continue-on-error: false strategy: From 88f7dc17eb271e37caf381f02eb75b3493e2b4a5 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 24 Nov 2023 15:48:40 +0100 Subject: [PATCH 29/35] [SCEV] Regenerate test checks (NFC) There have been some minor but pervasive changes to the generated CHECK lines, so regenerate all of them, to minimize future diffs. --- .../Analysis/ScalarEvolution/add-like-or.ll | 2 +- ...drec-computed-during-addrec-calculation.ll | 4 +- .../ScalarEvolution/addrec-sub-nsw.ll | 4 +- llvm/test/Analysis/ScalarEvolution/alloca.ll | 2 +- .../backedge-taken-count-guard-info.ll | 4 +- .../ScalarEvolution/decrementing_addrecs.ll | 4 +- .../exact-exit-count-more-precise.ll | 4 +- .../ScalarEvolution/exit-count-select-safe.ll | 78 ++++++++-------- .../ScalarEvolution/exit-count-select.ll | 12 +-- .../extract-lowbits-sameconstmask.ll | 10 +-- .../ScalarEvolution/finite-trip-count.ll | 18 ++-- .../flags-from-poison-noautogen.ll | 8 +- .../ScalarEvolution/flags-from-poison.ll | 66 +++++++------- llvm/test/Analysis/ScalarEvolution/fold.ll | 2 +- .../ScalarEvolution/huge-trip-multiple.ll | 10 +-- .../increasing-or-decreasing-iv.ll | 16 ++-- llvm/test/Analysis/ScalarEvolution/load.ll | 4 +- .../ScalarEvolution/logical-operations.ll | 2 +- .../lshr-shl-differentconstmask.ll | 36 ++++---- llvm/test/Analysis/ScalarEvolution/malloc.ll | 2 +- ...en-count-guard-info-rewrite-expressions.ll | 36 ++++---- .../max-backedge-taken-count-guard-info.ll | 90 +++++++++---------- ...-backedge-taken-count-limit-by-wrapping.ll | 8 +- .../max-be-count-not-constant.ll | 2 +- .../ScalarEvolution/max-expr-cache.ll | 4 +- .../Analysis/ScalarEvolution/min-max-exprs.ll | 2 +- .../Analysis/ScalarEvolution/ne-overflow.ll | 10 +-- .../no-wrap-symbolic-becount.ll | 4 +- .../ScalarEvolution/nsw-offset-assume.ll | 2 +- .../Analysis/ScalarEvolution/nsw-offset.ll | 2 +- llvm/test/Analysis/ScalarEvolution/nsw.ll | 18 ++-- .../overflow-intrinsics-trip-count.ll | 22 ++--- .../ScalarEvolution/predicated-trip-count.ll | 4 +- .../test/Analysis/ScalarEvolution/ptrtoint.ll | 12 +-- .../ScalarEvolution/range-signedness.ll | 2 +- .../Analysis/ScalarEvolution/range_nw_flag.ll | 12 +-- llvm/test/Analysis/ScalarEvolution/ranges.ll | 12 +-- llvm/test/Analysis/ScalarEvolution/sdiv.ll | 2 +- .../ScalarEvolution/sext-add-inreg-loop.ll | 2 +- .../test/Analysis/ScalarEvolution/sext-mul.ll | 4 +- .../Analysis/ScalarEvolution/sext-to-zext.ll | 2 +- .../ScalarEvolution/shift-recurrences.ll | 34 +++---- .../shl-lshr-differentconstmask.ll | 36 ++++---- .../ScalarEvolution/smax-br-phi-idioms.ll | 2 +- .../ScalarEvolution/smin-smax-folds.ll | 6 +- .../ScalarEvolution/solve-quadratic-i1.ll | 4 +- .../solve-quadratic-overflow.ll | 2 +- llvm/test/Analysis/ScalarEvolution/srem.ll | 2 +- .../symbolic_max_exit_count.ll | 2 +- .../trip-count-andor-selectform.ll | 24 ++--- .../ScalarEvolution/trip-count-andor.ll | 24 ++--- .../trip-count-implied-addrec.ll | 24 ++--- .../ScalarEvolution/trip-count-minmax.ll | 14 +-- .../Analysis/ScalarEvolution/trip-count.ll | 6 +- .../Analysis/ScalarEvolution/trip-count10.ll | 6 +- .../Analysis/ScalarEvolution/trip-count14.ll | 16 ++-- .../Analysis/ScalarEvolution/trip-count15.ll | 6 +- .../Analysis/ScalarEvolution/trip-count2.ll | 2 +- .../Analysis/ScalarEvolution/trip-count3.ll | 2 +- .../Analysis/ScalarEvolution/trip-count4.ll | 2 +- .../Analysis/ScalarEvolution/trip-count8.ll | 2 +- .../Analysis/ScalarEvolution/trip-count9.ll | 42 ++++----- .../trip-multiple-guard-info.ll | 32 +++---- .../Analysis/ScalarEvolution/trip-multiple.ll | 16 ++-- .../ScalarEvolution/umin-umax-folds.ll | 18 ++-- .../Analysis/ScalarEvolution/unknown_phis.ll | 2 +- 66 files changed, 433 insertions(+), 433 deletions(-) diff --git a/llvm/test/Analysis/ScalarEvolution/add-like-or.ll b/llvm/test/Analysis/ScalarEvolution/add-like-or.ll index e144755d8fba7a..38b6c44fdf3568 100644 --- a/llvm/test/Analysis/ScalarEvolution/add-like-or.ll +++ b/llvm/test/Analysis/ScalarEvolution/add-like-or.ll @@ -36,7 +36,7 @@ define void @mask-high(i64 %arg, ptr dereferenceable(4) %arg1) { ; CHECK-NEXT: Loop %bb6: symbolic max backedge-taken count is (-1 + (-16 * (%arg /u 16)) + ((sext i32 %i to i64) smax (1 + (16 * (%arg /u 16))))) ; CHECK-NEXT: Loop %bb6: Predicated backedge-taken count is (-1 + (-16 * (%arg /u 16)) + ((sext i32 %i to i64) smax (1 + (16 * (%arg /u 16))))) ; CHECK-NEXT: Predicates: -; CHECK: Loop %bb6: Trip multiple is 1 +; CHECK-NEXT: Loop %bb6: Trip multiple is 1 ; bb: %i = load i32, ptr %arg1, align 4 diff --git a/llvm/test/Analysis/ScalarEvolution/addrec-computed-during-addrec-calculation.ll b/llvm/test/Analysis/ScalarEvolution/addrec-computed-during-addrec-calculation.ll index 56be4e0726f8e2..9dfde18b6fdae1 100644 --- a/llvm/test/Analysis/ScalarEvolution/addrec-computed-during-addrec-calculation.ll +++ b/llvm/test/Analysis/ScalarEvolution/addrec-computed-during-addrec-calculation.ll @@ -24,7 +24,7 @@ define void @test(ptr %p) { ; CHECK-NEXT: %iv3.next = add nsw i64 %iv3, 1 ; CHECK-NEXT: --> {(1 + (sext i32 {%iv,+,1}<%loop2> to i64)),+,1}<%loop3> U: [-2147483647,2147483649) S: [-2147483647,2147483649) Exits: (1 + (sext i32 {%iv,+,1}<%loop2> to i64)) LoopDispositions: { %loop3: Computable, %loop.header: Variant } ; CHECK-NEXT: %iv.next = trunc i64 %iv3 to i32 -; CHECK-NEXT: --> {{{.*}}{%iv,+,1}<%loop2>,+,1}<%loop3> U: full-set S: full-set --> {%iv,+,1}<%loop2> U: full-set S: full-set Exits: <> LoopDispositions: { %loop.header: Variant, %loop2: Variant, %loop3: Computable } +; CHECK-NEXT: --> {{\{\{}}%iv,+,1}<%loop2>,+,1}<%loop3> U: full-set S: full-set --> {%iv,+,1}<%loop2> U: full-set S: full-set Exits: <> LoopDispositions: { %loop.header: Variant, %loop2: Variant, %loop3: Computable } ; CHECK-NEXT: Determining loop execution counts for: @test ; CHECK-NEXT: Loop %loop2: Unpredictable backedge-taken count. ; CHECK-NEXT: Loop %loop2: constant max backedge-taken count is -1 @@ -35,7 +35,7 @@ define void @test(ptr %p) { ; CHECK-NEXT: Loop %loop3: symbolic max backedge-taken count is false ; CHECK-NEXT: Loop %loop3: Predicated backedge-taken count is false ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop3: Trip multiple is 1 +; CHECK-NEXT: Loop %loop3: Trip multiple is 1 ; CHECK-NEXT: Loop %loop.header: Unpredictable backedge-taken count. ; CHECK-NEXT: Loop %loop.header: Unpredictable constant max backedge-taken count. ; CHECK-NEXT: Loop %loop.header: Unpredictable symbolic max backedge-taken count. diff --git a/llvm/test/Analysis/ScalarEvolution/addrec-sub-nsw.ll b/llvm/test/Analysis/ScalarEvolution/addrec-sub-nsw.ll index 032aaa4a701076..cf59ff8812bbc9 100644 --- a/llvm/test/Analysis/ScalarEvolution/addrec-sub-nsw.ll +++ b/llvm/test/Analysis/ScalarEvolution/addrec-sub-nsw.ll @@ -16,7 +16,7 @@ define i32 @test_1_non_negative(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + (1 smax %n)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + (1 smax %n)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %precond = icmp sge i32 %n, 0 @@ -55,7 +55,7 @@ define i32 @test_2_non_positive(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + (1 smax %n)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + (1 smax %n)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %precond = icmp sge i32 %n, 0 diff --git a/llvm/test/Analysis/ScalarEvolution/alloca.ll b/llvm/test/Analysis/ScalarEvolution/alloca.ll index fbbdf02be1936e..1a704322bf05a2 100644 --- a/llvm/test/Analysis/ScalarEvolution/alloca.ll +++ b/llvm/test/Analysis/ScalarEvolution/alloca.ll @@ -48,7 +48,7 @@ define void @alloca_icmp_null_exit_count() { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 2 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 2 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 3 +; CHECK-NEXT: Loop %loop: Trip multiple is 3 ; entry: %alloca = alloca [3 x i32], align 4 diff --git a/llvm/test/Analysis/ScalarEvolution/backedge-taken-count-guard-info.ll b/llvm/test/Analysis/ScalarEvolution/backedge-taken-count-guard-info.ll index 8e0b29cc62d14f..2c29447358b387 100644 --- a/llvm/test/Analysis/ScalarEvolution/backedge-taken-count-guard-info.ll +++ b/llvm/test/Analysis/ScalarEvolution/backedge-taken-count-guard-info.ll @@ -18,7 +18,7 @@ define void @loop_guard_improves_exact_backedge_taken_count_1(i32 %conv) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 0 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 0 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %and = and i32 %conv, 1 @@ -54,7 +54,7 @@ define void @loop_guard_improves_exact_backedge_taken_count_2(i32 %conv) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (zext i1 (trunc i32 %conv to i1) to i64) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (zext i1 (trunc i32 %conv to i1) to i64) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 2 +; CHECK-NEXT: Loop %loop: Trip multiple is 2 ; entry: %and = and i32 %conv, 1 diff --git a/llvm/test/Analysis/ScalarEvolution/decrementing_addrecs.ll b/llvm/test/Analysis/ScalarEvolution/decrementing_addrecs.ll index 9ca82061dc4998..e92f66cf6e18ed 100644 --- a/llvm/test/Analysis/ScalarEvolution/decrementing_addrecs.ll +++ b/llvm/test/Analysis/ScalarEvolution/decrementing_addrecs.ll @@ -51,7 +51,7 @@ define i32 @test_step_1_flags(i32 %n) { ; DEFAULT-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %n) ; DEFAULT-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %n) ; DEFAULT-NEXT: Predicates: -; DEFAULT: Loop %loop: Trip multiple is 1 +; DEFAULT-NEXT: Loop %loop: Trip multiple is 1 ; ; EXPENSIVE_SHARPENING-LABEL: 'test_step_1_flags' ; EXPENSIVE_SHARPENING-NEXT: Classifying expressions for: @test_step_1_flags @@ -77,7 +77,7 @@ define i32 @test_step_1_flags(i32 %n) { ; EXPENSIVE_SHARPENING-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %n) ; EXPENSIVE_SHARPENING-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %n) ; EXPENSIVE_SHARPENING-NEXT: Predicates: -; EXPENSIVE_SHARPENING: Loop %loop: Trip multiple is 1 +; EXPENSIVE_SHARPENING-NEXT: Loop %loop: Trip multiple is 1 ; entry: %n.minus.1 = sub nsw i32 %n, 1 diff --git a/llvm/test/Analysis/ScalarEvolution/exact-exit-count-more-precise.ll b/llvm/test/Analysis/ScalarEvolution/exact-exit-count-more-precise.ll index 4b652c7e6df5de..19a65b4aa37109 100644 --- a/llvm/test/Analysis/ScalarEvolution/exact-exit-count-more-precise.ll +++ b/llvm/test/Analysis/ScalarEvolution/exact-exit-count-more-precise.ll @@ -18,7 +18,7 @@ define void @test_and(i16 %in) { ; CHECK-NEXT: Loop %bb1.i: symbolic max backedge-taken count is (1 + (-1 * %in)) ; CHECK-NEXT: Loop %bb1.i: Predicated backedge-taken count is (1 + (-1 * %in)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %bb1.i: Trip multiple is 1 +; CHECK-NEXT: Loop %bb1.i: Trip multiple is 1 ; CHECK-NEXT: Loop %bb2: Unpredictable backedge-taken count. ; CHECK-NEXT: Loop %bb2: Unpredictable constant max backedge-taken count. ; CHECK-NEXT: Loop %bb2: Unpredictable symbolic max backedge-taken count. @@ -60,7 +60,7 @@ define void @test_or() { ; CHECK-NEXT: Loop %BB: symbolic max backedge-taken count is undef ; CHECK-NEXT: Loop %BB: Predicated backedge-taken count is undef ; CHECK-NEXT: Predicates: -; CHECK: Loop %BB: Trip multiple is 1 +; CHECK-NEXT: Loop %BB: Trip multiple is 1 ; %C10 = icmp slt i1 undef, undef br i1 %C10, label %BB, label %exit diff --git a/llvm/test/Analysis/ScalarEvolution/exit-count-select-safe.ll b/llvm/test/Analysis/ScalarEvolution/exit-count-select-safe.ll index cf52c1b6cf8a25..2af1309cab7e4f 100644 --- a/llvm/test/Analysis/ScalarEvolution/exit-count-select-safe.ll +++ b/llvm/test/Analysis/ScalarEvolution/exit-count-select-safe.ll @@ -16,7 +16,7 @@ define i32 @logical_and_2ops(i32 %n, i32 %m) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq %m) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%n umin_seq %m) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -46,7 +46,7 @@ define i32 @logical_or_2ops(i32 %n, i32 %m) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq %m) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%n umin_seq %m) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -78,7 +78,7 @@ define i32 @logical_and_3ops(i32 %n, i32 %m, i32 %k) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq %m umin_seq %k) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%n umin_seq %m umin_seq %k) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -112,7 +112,7 @@ define i32 @logical_or_3ops(i32 %n, i32 %m, i32 %k) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq %m umin_seq %k) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%n umin_seq %m umin_seq %k) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -148,7 +148,7 @@ define i32 @logical_or_3ops_duplicate(i32 %n, i32 %m, i32 %k) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq %m umin_seq %k) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%n umin_seq %m umin_seq %k) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -186,7 +186,7 @@ define i32 @logical_or_3ops_redundant_uminseq_operand(i32 %n, i32 %m, i32 %k) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((%n umin %m) umin_seq %k) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((%n umin %m) umin_seq %k) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -223,7 +223,7 @@ define i32 @logical_or_3ops_redundant_umin_operand(i32 %n, i32 %m, i32 %k) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq %k umin_seq %m) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%n umin_seq %k umin_seq %m) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -262,7 +262,7 @@ define i32 @logical_or_4ops_redundant_operand_across_umins(i32 %n, i32 %m, i32 % ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((%n umin %m) umin_seq %k umin_seq %q) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((%n umin %m) umin_seq %k umin_seq %q) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -302,7 +302,7 @@ define i32 @logical_or_3ops_operand_wise_redundant_umin(i32 %n, i32 %m, i32 %k) ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((%n umin %m) umin_seq %k) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((%n umin %m) umin_seq %k) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -340,7 +340,7 @@ define i32 @logical_or_3ops_partially_redundant_umin(i32 %n, i32 %m, i32 %k) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq (%m umin %k)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%n umin_seq (%m umin %k)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -386,13 +386,13 @@ define i32 @logical_or_5ops_redundant_opearand_of_inner_uminseq(i32 %a, i32 %b, ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%a umin_seq %b umin_seq ((%e umin_seq %d) umin %c)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%a umin_seq %b umin_seq ((%e umin_seq %d) umin %c)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; CHECK-NEXT: Loop %first.loop: backedge-taken count is (%e umin_seq %d umin_seq %a) ; CHECK-NEXT: Loop %first.loop: constant max backedge-taken count is -1 ; CHECK-NEXT: Loop %first.loop: symbolic max backedge-taken count is (%e umin_seq %d umin_seq %a) ; CHECK-NEXT: Loop %first.loop: Predicated backedge-taken count is (%e umin_seq %d umin_seq %a) ; CHECK-NEXT: Predicates: -; CHECK: Loop %first.loop: Trip multiple is 1 +; CHECK-NEXT: Loop %first.loop: Trip multiple is 1 ; entry: br label %first.loop @@ -439,7 +439,7 @@ define i32 @logical_and_2ops_and_constant(i32 %n, i32 %m, i32 %k) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (42 umin %n) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (42 umin %n) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -478,13 +478,13 @@ define i32 @computeSCEVAtScope(i32 %d.0) { ; CHECK-NEXT: Loop %for.cond: symbolic max backedge-taken count is (-1 * %d.0) ; CHECK-NEXT: Loop %for.cond: Predicated backedge-taken count is (-1 * %d.0) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.cond: Trip multiple is 1 +; CHECK-NEXT: Loop %for.cond: Trip multiple is 1 ; CHECK-NEXT: Loop %for.cond4: backedge-taken count is 0 ; CHECK-NEXT: Loop %for.cond4: constant max backedge-taken count is 0 ; CHECK-NEXT: Loop %for.cond4: symbolic max backedge-taken count is 0 ; CHECK-NEXT: Loop %for.cond4: Predicated backedge-taken count is 0 ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.cond4: Trip multiple is 1 +; CHECK-NEXT: Loop %for.cond4: Trip multiple is 1 ; CHECK-NEXT: Loop %while.cond: Unpredictable backedge-taken count. ; CHECK-NEXT: Loop %while.cond: Unpredictable constant max backedge-taken count. ; CHECK-NEXT: Loop %while.cond: Unpredictable symbolic max backedge-taken count. @@ -547,7 +547,7 @@ define i64 @uminseq_vs_ptrtoint_complexity(i64 %n, i64 %m, ptr %ptr) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq %m) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%n umin_seq %m) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -581,7 +581,7 @@ define i32 @logical_and_implies_poison1(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((1 + %n) umin %n) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((1 + %n) umin %n) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %add = add i32 %n, 1 @@ -614,7 +614,7 @@ define i32 @logical_and_implies_poison2(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((1 + %n) umin %n) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((1 + %n) umin %n) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %add = add i32 %n, 1 @@ -647,7 +647,7 @@ define i32 @logical_and_implies_poison3(i32 %n, i32 %m) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((%n + %m) umin %n) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((%n + %m) umin %n) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %add = add i32 %n, %m @@ -680,7 +680,7 @@ define i32 @logical_and_implies_poison_wrong_direction(i32 %n, i32 %m) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq (%n + %m)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%n umin_seq (%n + %m)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %add = add i32 %n, %m @@ -711,7 +711,7 @@ define i32 @logical_and_implies_poison_noundef(i32 %n, i32 noundef %m) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin %m) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%n umin %m) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -741,7 +741,7 @@ define i32 @logical_and_implies_poison_noundef_wrong_direction(i32 %n, i32 nound ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%m umin_seq %n) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%m umin_seq %n) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -775,7 +775,7 @@ define i32 @logical_and_implies_poison_complex1(i32 %n, i32 %m) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((%n + %m) umin (1 + %n + %m)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((%n + %m) umin (1 + %n + %m)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %add = add i32 %n, %m @@ -811,7 +811,7 @@ define i32 @logical_and_implies_poison_complex2(i32 %n, i32 %m, i32 %l) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((%n + %m) umin (%n + %m + %l)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((%n + %m) umin (%n + %m + %l)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %add = add i32 %n, %m @@ -847,7 +847,7 @@ define i32 @logical_and_implies_poison_complex_wrong_direction(i32 %n, i32 %m, i ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((%n + %m) umin_seq (%n + %m + %l)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((%n + %m) umin_seq (%n + %m + %l)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %add = add i32 %n, %m @@ -883,7 +883,7 @@ define i32 @logical_and_implies_multiple_ops(i32 %n, i32 %m) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (((1 + %n) umin %n) umin_seq %m) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (((1 + %n) umin %n) umin_seq %m) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %add = add i32 %n, 1 @@ -920,7 +920,7 @@ define i32 @logical_and_implies_multiple_ops2(i32 %n, i32 %m) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq ((1 + %n) umin %m)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%n umin_seq ((1 + %n) umin %m)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %add = add i32 %n, 1 @@ -957,7 +957,7 @@ define i32 @logical_and_implies_multiple_ops3(i32 %n, i32 %m) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%m umin_seq ((1 + %n) umin %n)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%m umin_seq ((1 + %n) umin %n)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %add = add i32 %n, 1 @@ -994,7 +994,7 @@ define i32 @logical_and_not_zero(i16 %n, i32 %m) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((1 + (zext i16 %n to i32)) umin %m) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((1 + (zext i16 %n to i32)) umin %m) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %n.ext = zext i16 %n to i32 @@ -1030,7 +1030,7 @@ define i32 @logical_and_not_zero_wrong_order(i16 %n, i32 %m) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%m umin_seq (1 + (zext i16 %n to i32))) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%m umin_seq (1 + (zext i16 %n to i32))) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %n.ext = zext i16 %n to i32 @@ -1062,7 +1062,7 @@ define i32 @logical_and_not_zero_needs_context(i32 %n, i32 %m) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq %m) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%n umin_seq %m) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %cmp = icmp ne i32 %n, 0 @@ -1101,7 +1101,7 @@ define i32 @logical_and_known_smaller(i16 %n, i16 %m) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (zext i16 %n to i32) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (zext i16 %n to i32) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %n.ext = zext i16 %n to i32 @@ -1140,7 +1140,7 @@ define i32 @logical_and_known_smaller_equal(i16 %n, i16 %m) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (zext i16 %n to i32) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (zext i16 %n to i32) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %n.ext = zext i16 %n to i32 @@ -1179,7 +1179,7 @@ define i32 @logical_and_not_known_smaller_equal(i16 %n, i16 %m) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((zext i16 %n to i32) umin_seq (65534 + (zext i16 %m to i32))) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((zext i16 %n to i32) umin_seq (65534 + (zext i16 %m to i32))) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %n.ext = zext i16 %n to i32 @@ -1218,7 +1218,7 @@ define i32 @logical_and_known_greater(i16 %n, i16 %m) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (zext i16 %n to i32) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (zext i16 %n to i32) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %n.ext = zext i16 %n to i32 @@ -1257,7 +1257,7 @@ define i32 @logical_and_known_greater_equal(i16 %n, i16 %m) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (zext i16 %n to i32) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (zext i16 %n to i32) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %n.ext = zext i16 %n to i32 @@ -1296,7 +1296,7 @@ define i32 @logical_and_not_known_greater_equal(i16 %n, i16 %m) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((zext i16 %n to i32) umin (65534 + (zext i16 %m to i32))) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((zext i16 %n to i32) umin (65534 + (zext i16 %m to i32))) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %n.ext = zext i16 %n to i32 @@ -1329,7 +1329,7 @@ define i32 @logical_and_zero_arg1(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 0 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 0 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -1359,7 +1359,7 @@ define i32 @logical_and_zero_arg2(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 0 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 0 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop diff --git a/llvm/test/Analysis/ScalarEvolution/exit-count-select.ll b/llvm/test/Analysis/ScalarEvolution/exit-count-select.ll index f8a90ddaf08eec..f9de34e54b9e93 100644 --- a/llvm/test/Analysis/ScalarEvolution/exit-count-select.ll +++ b/llvm/test/Analysis/ScalarEvolution/exit-count-select.ll @@ -18,7 +18,7 @@ define void @logical_and_m_const(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (2 umin %n) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (2 umin %n) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -50,7 +50,7 @@ define void @logical_and_nonzero(i32 %m) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (2 umin %m) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (2 umin %m) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -83,7 +83,7 @@ define void @logical_and_zero(i32 %m) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 0 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 0 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -147,7 +147,7 @@ define void @logical_or_m_const(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (2 umin %n) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (2 umin %n) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -179,7 +179,7 @@ define void @logical_or_nonzero(i32 %m) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (2 umin %m) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (2 umin %m) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -212,7 +212,7 @@ define void @logical_or_zero(i32 %m) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 0 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 0 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop diff --git a/llvm/test/Analysis/ScalarEvolution/extract-lowbits-sameconstmask.ll b/llvm/test/Analysis/ScalarEvolution/extract-lowbits-sameconstmask.ll index fcb0322cc39684..b98f966473f4ea 100644 --- a/llvm/test/Analysis/ScalarEvolution/extract-lowbits-sameconstmask.ll +++ b/llvm/test/Analysis/ScalarEvolution/extract-lowbits-sameconstmask.ll @@ -6,9 +6,9 @@ define i32 @mul(i32 %val) nounwind { ; CHECK-LABEL: 'mul' ; CHECK-NEXT: Classifying expressions for: @mul ; CHECK-NEXT: %tmp1 = mul i32 %val, 16 -; CHECK-NEXT: --> (16 * %val) U: [0,-15) S: [-2147483648,2147483633) +; CHECK-NEXT: --> (16 * %val) U: [0,-15) S: [-2147483648,2147483633) ; CHECK-NEXT: %tmp2 = udiv i32 %tmp1, 16 -; CHECK-NEXT: --> ((16 * %val) /u 16) U: [0,268435456) S: [0,268435456) +; CHECK-NEXT: --> ((16 * %val) /u 16) U: [0,268435456) S: [0,268435456) ; CHECK-NEXT: Determining loop execution counts for: @mul ; %tmp1 = mul i32 %val, 16 @@ -26,7 +26,7 @@ define i32 @mask_abc(i32 %val) nounwind { ; CHECK-LABEL: 'mask_abc' ; CHECK-NEXT: Classifying expressions for: @mask_abc ; CHECK-NEXT: %masked = and i32 %val, 15 -; CHECK-NEXT: --> (zext i4 (trunc i32 %val to i4) to i32) U: [0,16) S: [0,16) +; CHECK-NEXT: --> (zext i4 (trunc i32 %val to i4) to i32) U: [0,16) S: [0,16) ; CHECK-NEXT: Determining loop execution counts for: @mask_abc ; %masked = and i32 %val, 15 @@ -37,9 +37,9 @@ define i32 @mask_d(i32 %val) nounwind { ; CHECK-LABEL: 'mask_d' ; CHECK-NEXT: Classifying expressions for: @mask_d ; CHECK-NEXT: %highbitscleared = shl i32 %val, 4 -; CHECK-NEXT: --> (16 * %val) U: [0,-15) S: [-2147483648,2147483633) +; CHECK-NEXT: --> (16 * %val) U: [0,-15) S: [-2147483648,2147483633) ; CHECK-NEXT: %masked = lshr i32 %highbitscleared, 4 -; CHECK-NEXT: --> ((16 * %val) /u 16) U: [0,268435456) S: [0,268435456) +; CHECK-NEXT: --> ((16 * %val) /u 16) U: [0,268435456) S: [0,268435456) ; CHECK-NEXT: Determining loop execution counts for: @mask_d ; %highbitscleared = shl i32 %val, 4 diff --git a/llvm/test/Analysis/ScalarEvolution/finite-trip-count.ll b/llvm/test/Analysis/ScalarEvolution/finite-trip-count.ll index a6b49756719853..af7454a3570a60 100644 --- a/llvm/test/Analysis/ScalarEvolution/finite-trip-count.ll +++ b/llvm/test/Analysis/ScalarEvolution/finite-trip-count.ll @@ -14,7 +14,7 @@ define void @sle_pre_inc(i32 %len) willreturn { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (0 smax (1 + %len)) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (0 smax (1 + %len)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; entry: br label %for.body @@ -38,7 +38,7 @@ define void @sle_post_inc(i32 %len) willreturn { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + (1 smax (1 + %len))) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + (1 smax (1 + %len))) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; entry: br label %for.body @@ -84,7 +84,7 @@ define void @ule_pre_inc(i32 %len) willreturn { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (1 + %len) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (1 + %len) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; entry: br label %for.body @@ -108,7 +108,7 @@ define void @ule_post_inc(i32 %len) willreturn { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + (1 umax (1 + %len))) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + (1 umax (1 + %len))) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; entry: br label %for.body @@ -154,7 +154,7 @@ define void @sge_pre_inc(i32 %end) willreturn { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (100 + (-1 * (100 smin (-1 + %end)))) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (100 + (-1 * (100 smin (-1 + %end)))) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; entry: br label %for.body @@ -178,7 +178,7 @@ define void @sge_post_inc(i32 %end) willreturn { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (100 + (-1 * (100 smin (-1 + %end)))) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (100 + (-1 * (100 smin (-1 + %end)))) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; entry: br label %for.body @@ -224,7 +224,7 @@ define void @use_pre_inc(i32 %end) willreturn { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (100 + (-1 * (100 umin (-1 + %end)))) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (100 + (-1 * (100 umin (-1 + %end)))) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; entry: br label %for.body @@ -248,7 +248,7 @@ define void @use_post_inc(i32 %end) willreturn { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (99 + (-1 * (99 umin (-1 + %end)))) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (99 + (-1 * (99 umin (-1 + %end)))) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; entry: br label %for.body @@ -294,7 +294,7 @@ define void @pr54191(i64 %n) mustprogress { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-2 + %n) /u 2) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-2 + %n) /u 2) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %guard = icmp sgt i64 %n, 1 diff --git a/llvm/test/Analysis/ScalarEvolution/flags-from-poison-noautogen.ll b/llvm/test/Analysis/ScalarEvolution/flags-from-poison-noautogen.ll index 54652489dbd1e6..0f49ad4aabc481 100644 --- a/llvm/test/Analysis/ScalarEvolution/flags-from-poison-noautogen.ll +++ b/llvm/test/Analysis/ScalarEvolution/flags-from-poison-noautogen.ll @@ -19,22 +19,22 @@ define void @subrecurrences(i32 %outer_l, i32 %inner_l, i32 %val) { ; CHECK-NEXT: %i_idx.inc = add nsw i32 %i_idx, 1 ; CHECK-NEXT: --> {1,+,1}<%inner> U: [1,0) S: [1,0) Exits: (1 + %inner_l) LoopDispositions: { %inner: Computable, %outer: Variant } ; CHECK-NEXT: %v = sub nsw i32 %i_idx, %o_idx.inc -; CHECK-NEXT: --> {{\{}}{-1,+,-1}<%outer>,+,1}<%inner> U: full-set S: full-set Exits: {(-1 + %inner_l),+,-1}<%outer> LoopDispositions: { %inner: Computable, %outer: Variant } +; CHECK-NEXT: --> {{\{\{}}-1,+,-1}<%outer>,+,1}<%inner> U: full-set S: full-set Exits: {(-1 + %inner_l),+,-1}<%outer> LoopDispositions: { %inner: Computable, %outer: Variant } ; CHECK-NEXT: %forub = udiv i32 1, %v -; CHECK-NEXT: --> (1 /u {{\{}}{-1,+,-1}<%outer>,+,1}<%inner>) U: [0,2) S: [0,2) Exits: (1 /u {(-1 + %inner_l),+,-1}<%outer>) LoopDispositions: { %inner: Computable, %outer: Variant } +; CHECK-NEXT: --> (1 /u {{\{\{}}-1,+,-1}<%outer>,+,1}<%inner>) U: [0,2) S: [0,2) Exits: (1 /u {(-1 + %inner_l),+,-1}<%outer>) LoopDispositions: { %inner: Computable, %outer: Variant } ; CHECK-NEXT: Determining loop execution counts for: @subrecurrences ; CHECK-NEXT: Loop %inner: backedge-taken count is %inner_l ; CHECK-NEXT: Loop %inner: constant max backedge-taken count is -1 ; CHECK-NEXT: Loop %inner: symbolic max backedge-taken count is %inner_l ; CHECK-NEXT: Loop %inner: Predicated backedge-taken count is %inner_l ; CHECK-NEXT: Predicates: -; CHECK: Loop %inner: Trip multiple is 1 +; CHECK-NEXT: Loop %inner: Trip multiple is 1 ; CHECK-NEXT: Loop %outer: backedge-taken count is %outer_l ; CHECK-NEXT: Loop %outer: constant max backedge-taken count is -1 ; CHECK-NEXT: Loop %outer: symbolic max backedge-taken count is %outer_l ; CHECK-NEXT: Loop %outer: Predicated backedge-taken count is %outer_l ; CHECK-NEXT: Predicates: -; CHECK: Loop %outer: Trip multiple is 1 +; CHECK-NEXT: Loop %outer: Trip multiple is 1 ; entry: br label %outer diff --git a/llvm/test/Analysis/ScalarEvolution/flags-from-poison.ll b/llvm/test/Analysis/ScalarEvolution/flags-from-poison.ll index a5bdee5c3b459b..84e68dd175776a 100644 --- a/llvm/test/Analysis/ScalarEvolution/flags-from-poison.ll +++ b/llvm/test/Analysis/ScalarEvolution/flags-from-poison.ll @@ -34,7 +34,7 @@ define void @test-add-nsw(ptr %input, i32 %offset, i32 %numIterations) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -73,7 +73,7 @@ define void @test-add-nuw(ptr %input, i32 %offset, i32 %numIterations) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -113,7 +113,7 @@ define void @test-add-scope-invariant(ptr %input, i32 %needle) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + (-1 * %offset) + %needle) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + (-1 * %offset) + %needle) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %offset = load i32, ptr %input @@ -396,7 +396,7 @@ define void @test-add-nuw-from-icmp(ptr %input, i32 %offset, ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; i32 %numIterations) { entry: @@ -436,7 +436,7 @@ define void @test-add-no-load(ptr %input, i32 %offset, i32 %numIterations) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -474,7 +474,7 @@ define void @test-add-not-header(ptr %input, i32 %offset, i32 %numIterations) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -513,7 +513,7 @@ define void @test-add-not-header2(ptr %input, i32 %offset, i32 %numIterations) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -597,7 +597,7 @@ define void @test-add-not-header4(ptr %input, i32 %offset, i32 %numIterations) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -674,7 +674,7 @@ define void @test-add-not-header6(ptr %input, i32 %offset, i32 %numIterations) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -713,7 +713,7 @@ define void @test-add-not-header7(ptr %input, i32 %offset, i32 %numIterations) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -754,7 +754,7 @@ define void @test-add-not-header8(ptr %input, i32 %offset, i32 %numIterations) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -795,7 +795,7 @@ define void @test-add-call(ptr %input, i32 %offset, i32 %numIterations) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -833,7 +833,7 @@ define void @test-add-call2(ptr %input, i32 %offset, i32 %numIterations) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -870,7 +870,7 @@ define void @test-gep-propagates-poison(ptr %input, i32 %offset, i32 %numIterati ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -909,7 +909,7 @@ define void @test-add-mul-propagates(ptr %input, i32 %offset, i32 %numIterations ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -948,7 +948,7 @@ define void @test-mul-propagates-poison(ptr %input, i32 %offset, i32 %numIterati ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -986,7 +986,7 @@ define void @test-mul-propagates-poison-2(ptr %input, i32 %offset, i32 %numItera ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -1023,7 +1023,7 @@ define void @test-add-div(ptr %input, i32 %offset, i32 %numIterations) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -1058,7 +1058,7 @@ define void @test-add-div2(ptr %input, i32 %offset, i32 %numIterations) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -1093,7 +1093,7 @@ define void @test-add-store(ptr %input, i32 %offset, i32 %numIterations) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -1136,7 +1136,7 @@ define void @test-add-twice(ptr %input, i32 %offset, i32 %numIterations) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -1180,7 +1180,7 @@ define void @test-mul-nsw(ptr %input, i32 %stride, i32 %numIterations) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -1218,7 +1218,7 @@ define void @test-mul-nuw(ptr %input, i32 %stride, i32 %numIterations) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -1258,7 +1258,7 @@ define void @test-shl-nsw(ptr %input, i32 %start, i32 %numIterations) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + (-1 * %start) + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + (-1 * %start) + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -1298,7 +1298,7 @@ define void @test-shl-nuw-edgecase(ptr %input, i32 %start, i32 %numIterations) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + (-1 * %start) + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + (-1 * %start) + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -1338,7 +1338,7 @@ define void @test-shl-nuw-nsw(ptr %input, i32 %start, i32 %numIterations) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + (-1 * %start) + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + (-1 * %start) + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -1378,7 +1378,7 @@ define void @test-shl-no-nsw(ptr %input, i32 %start, i32 %numIterations) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + (-1 * %start) + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + (-1 * %start) + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -1418,7 +1418,7 @@ define void @test-shl-nsw-edgecase(ptr %input, i32 %start, i32 %numIterations) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + (-1 * %start) + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + (-1 * %start) + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -1456,7 +1456,7 @@ define void @test-shl-nuw(ptr %input, i32 %numIterations) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -1497,7 +1497,7 @@ define void @test-sub-no-nsw(ptr %input, i32 %start, i32 %sub, i32 %numIteration ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + (-1 * %start) + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + (-1 * %start) + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -1539,7 +1539,7 @@ define void @test-sub-nsw(ptr %input, i32 %start, i32 %sub, i32 %numIterations) ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + (-1 * %start) + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + (-1 * %start) + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %halfsub = ashr i32 %sub, 1 @@ -1580,7 +1580,7 @@ define void @test-sub-nsw-lhs-non-negative(ptr %input, i32 %sub, i32 %numIterati ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -1678,7 +1678,7 @@ define void @test-sub-with-add(ptr %input, i32 %offset, i32 %numIterations) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop diff --git a/llvm/test/Analysis/ScalarEvolution/fold.ll b/llvm/test/Analysis/ScalarEvolution/fold.ll index 2096d309b2435d..e8e3dc97c75192 100644 --- a/llvm/test/Analysis/ScalarEvolution/fold.ll +++ b/llvm/test/Analysis/ScalarEvolution/fold.ll @@ -82,7 +82,7 @@ define void @test4(i32 %x, i32 %y) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 20 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 20 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 21 +; CHECK-NEXT: Loop %loop: Trip multiple is 21 ; entry: %Y = and i32 %y, 3 diff --git a/llvm/test/Analysis/ScalarEvolution/huge-trip-multiple.ll b/llvm/test/Analysis/ScalarEvolution/huge-trip-multiple.ll index f511d0435a6396..55fcea22b58409 100644 --- a/llvm/test/Analysis/ScalarEvolution/huge-trip-multiple.ll +++ b/llvm/test/Analysis/ScalarEvolution/huge-trip-multiple.ll @@ -19,7 +19,7 @@ define void @trip_count_4294967295() { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is 4294967294 ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is 4294967294 ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 4294967295 +; CHECK-NEXT: Loop %for.body: Trip multiple is 4294967295 ; entry: br label %for.body @@ -48,7 +48,7 @@ define void @trip_count_4294967296() { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is 4294967295 ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is 4294967295 ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 2147483648 +; CHECK-NEXT: Loop %for.body: Trip multiple is 2147483648 ; entry: br label %for.body @@ -77,7 +77,7 @@ define void @trip_count_8589935692() { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is 8589934591 ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is 8589934591 ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 2147483648 +; CHECK-NEXT: Loop %for.body: Trip multiple is 2147483648 ; entry: br label %for.body @@ -106,7 +106,7 @@ define void @trip_count_9223372036854775808() { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is 9223372036854775807 ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is 9223372036854775807 ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 2147483648 +; CHECK-NEXT: Loop %for.body: Trip multiple is 2147483648 ; entry: br label %for.body @@ -135,7 +135,7 @@ define void @trip_count_18446744073709551615() { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is -2 ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is -2 ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; entry: br label %for.body diff --git a/llvm/test/Analysis/ScalarEvolution/increasing-or-decreasing-iv.ll b/llvm/test/Analysis/ScalarEvolution/increasing-or-decreasing-iv.ll index f3465b89ab879c..a264a7bf497921 100644 --- a/llvm/test/Analysis/ScalarEvolution/increasing-or-decreasing-iv.ll +++ b/llvm/test/Analysis/ScalarEvolution/increasing-or-decreasing-iv.ll @@ -22,7 +22,7 @@ define void @f0(i1 %c) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 127 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 127 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 128 +; CHECK-NEXT: Loop %loop: Trip multiple is 128 ; entry: %start = select i1 %c, i32 127, i32 0 @@ -90,7 +90,7 @@ define void @f1(i1 %c) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 15 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 15 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 16 +; CHECK-NEXT: Loop %loop: Trip multiple is 16 ; entry: %start = select i1 %c, i32 120, i32 0 @@ -151,7 +151,7 @@ define void @f2(i1 %c) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 127 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 127 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 128 +; CHECK-NEXT: Loop %loop: Trip multiple is 128 ; entry: %start = select i1 %c, i32 127, i32 0 @@ -194,7 +194,7 @@ define void @f3(i1 %c) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 127 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 127 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 128 +; CHECK-NEXT: Loop %loop: Trip multiple is 128 ; entry: @@ -244,7 +244,7 @@ define void @f4(i1 %c) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 127 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 127 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 128 +; CHECK-NEXT: Loop %loop: Trip multiple is 128 ; entry: @@ -288,7 +288,7 @@ define void @f5(i1 %c) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 127 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 127 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 128 +; CHECK-NEXT: Loop %loop: Trip multiple is 128 ; entry: %start = select i1 %c, i32 127, i32 0 @@ -334,7 +334,7 @@ define void @f6(i1 %c) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 127 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 127 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 128 +; CHECK-NEXT: Loop %loop: Trip multiple is 128 ; entry: %start = select i1 %c, i32 127, i32 0 @@ -383,7 +383,7 @@ define void @f7(i1 %c) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 127 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 127 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 128 +; CHECK-NEXT: Loop %loop: Trip multiple is 128 ; entry: %start = select i1 %c, i32 127, i32 0 diff --git a/llvm/test/Analysis/ScalarEvolution/load.ll b/llvm/test/Analysis/ScalarEvolution/load.ll index 3d2c2a2f501975..83b60c58d51741 100644 --- a/llvm/test/Analysis/ScalarEvolution/load.ll +++ b/llvm/test/Analysis/ScalarEvolution/load.ll @@ -35,7 +35,7 @@ define i32 @test1() nounwind readnone { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is 49 ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is 49 ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 50 +; CHECK-NEXT: Loop %for.body: Trip multiple is 50 ; entry: br label %for.body @@ -89,7 +89,7 @@ define i32 @test2() nounwind uwtable readonly { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is 4 ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is 4 ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 5 +; CHECK-NEXT: Loop %for.body: Trip multiple is 5 ; entry: br label %for.body diff --git a/llvm/test/Analysis/ScalarEvolution/logical-operations.ll b/llvm/test/Analysis/ScalarEvolution/logical-operations.ll index 4ca2fbef9014b6..3fe1bd1e164675 100644 --- a/llvm/test/Analysis/ScalarEvolution/logical-operations.ll +++ b/llvm/test/Analysis/ScalarEvolution/logical-operations.ll @@ -436,7 +436,7 @@ define ptr @tautological_select_like_phi(i32 %tc) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 100 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 100 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 101 +; CHECK-NEXT: Loop %loop: Trip multiple is 101 ; entry: br label %loop diff --git a/llvm/test/Analysis/ScalarEvolution/lshr-shl-differentconstmask.ll b/llvm/test/Analysis/ScalarEvolution/lshr-shl-differentconstmask.ll index 0a927c30ebf2c8..f2e2c5ee398705 100644 --- a/llvm/test/Analysis/ScalarEvolution/lshr-shl-differentconstmask.ll +++ b/llvm/test/Analysis/ScalarEvolution/lshr-shl-differentconstmask.ll @@ -6,9 +6,9 @@ define i32 @udiv_biggerLshr(i32 %val) nounwind { ; CHECK-LABEL: 'udiv_biggerLshr' ; CHECK-NEXT: Classifying expressions for: @udiv_biggerLshr ; CHECK-NEXT: %tmp1 = udiv i32 %val, 64 -; CHECK-NEXT: --> (%val /u 64) U: [0,67108864) S: [0,67108864) +; CHECK-NEXT: --> (%val /u 64) U: [0,67108864) S: [0,67108864) ; CHECK-NEXT: %tmp2 = mul i32 %tmp1, 16 -; CHECK-NEXT: --> (16 * (%val /u 64)) U: [0,1073741809) S: [0,1073741809) +; CHECK-NEXT: --> (16 * (%val /u 64)) U: [0,1073741809) S: [0,1073741809) ; CHECK-NEXT: Determining loop execution counts for: @udiv_biggerLshr ; %tmp1 = udiv i32 %val, 64 @@ -20,9 +20,9 @@ define i32 @udiv_biggerShl(i32 %val) nounwind { ; CHECK-LABEL: 'udiv_biggerShl' ; CHECK-NEXT: Classifying expressions for: @udiv_biggerShl ; CHECK-NEXT: %tmp1 = udiv i32 %val, 16 -; CHECK-NEXT: --> (%val /u 16) U: [0,268435456) S: [0,268435456) +; CHECK-NEXT: --> (%val /u 16) U: [0,268435456) S: [0,268435456) ; CHECK-NEXT: %tmp2 = mul i32 %tmp1, 64 -; CHECK-NEXT: --> (64 * (%val /u 16)) U: [0,-63) S: [-2147483648,2147483585) +; CHECK-NEXT: --> (64 * (%val /u 16)) U: [0,-63) S: [-2147483648,2147483585) ; CHECK-NEXT: Determining loop execution counts for: @udiv_biggerShl ; %tmp1 = udiv i32 %val, 16 @@ -36,9 +36,9 @@ define i32 @shifty_biggerLshr(i32 %val) { ; CHECK-LABEL: 'shifty_biggerLshr' ; CHECK-NEXT: Classifying expressions for: @shifty_biggerLshr ; CHECK-NEXT: %tmp1 = lshr i32 %val, 6 -; CHECK-NEXT: --> (%val /u 64) U: [0,67108864) S: [0,67108864) +; CHECK-NEXT: --> (%val /u 64) U: [0,67108864) S: [0,67108864) ; CHECK-NEXT: %tmp2 = shl i32 %tmp1, 4 -; CHECK-NEXT: --> (16 * (%val /u 64)) U: [0,1073741809) S: [0,1073741809) +; CHECK-NEXT: --> (16 * (%val /u 64)) U: [0,1073741809) S: [0,1073741809) ; CHECK-NEXT: Determining loop execution counts for: @shifty_biggerLshr ; %tmp1 = lshr i32 %val, 6 @@ -50,9 +50,9 @@ define i32 @shifty_biggerLshr_lshrexact(i32 %val) { ; CHECK-LABEL: 'shifty_biggerLshr_lshrexact' ; CHECK-NEXT: Classifying expressions for: @shifty_biggerLshr_lshrexact ; CHECK-NEXT: %tmp1 = lshr exact i32 %val, 6 -; CHECK-NEXT: --> (%val /u 64) U: [0,67108864) S: [0,67108864) +; CHECK-NEXT: --> (%val /u 64) U: [0,67108864) S: [0,67108864) ; CHECK-NEXT: %tmp2 = shl i32 %tmp1, 4 -; CHECK-NEXT: --> (16 * (%val /u 64)) U: [0,1073741809) S: [0,1073741809) +; CHECK-NEXT: --> (16 * (%val /u 64)) U: [0,1073741809) S: [0,1073741809) ; CHECK-NEXT: Determining loop execution counts for: @shifty_biggerLshr_lshrexact ; %tmp1 = lshr exact i32 %val, 6 @@ -64,9 +64,9 @@ define i32 @shifty_biggerShr(i32 %val) { ; CHECK-LABEL: 'shifty_biggerShr' ; CHECK-NEXT: Classifying expressions for: @shifty_biggerShr ; CHECK-NEXT: %tmp1 = lshr i32 %val, 4 -; CHECK-NEXT: --> (%val /u 16) U: [0,268435456) S: [0,268435456) +; CHECK-NEXT: --> (%val /u 16) U: [0,268435456) S: [0,268435456) ; CHECK-NEXT: %tmp2 = shl i32 %tmp1, 6 -; CHECK-NEXT: --> (64 * (%val /u 16)) U: [0,-63) S: [-2147483648,2147483585) +; CHECK-NEXT: --> (64 * (%val /u 16)) U: [0,-63) S: [-2147483648,2147483585) ; CHECK-NEXT: Determining loop execution counts for: @shifty_biggerShr ; %tmp1 = lshr i32 %val, 4 @@ -78,9 +78,9 @@ define i32 @shifty_biggerShr_lshrexact(i32 %val) { ; CHECK-LABEL: 'shifty_biggerShr_lshrexact' ; CHECK-NEXT: Classifying expressions for: @shifty_biggerShr_lshrexact ; CHECK-NEXT: %tmp1 = lshr exact i32 %val, 4 -; CHECK-NEXT: --> (%val /u 16) U: [0,268435456) S: [0,268435456) +; CHECK-NEXT: --> (%val /u 16) U: [0,268435456) S: [0,268435456) ; CHECK-NEXT: %tmp2 = shl i32 %tmp1, 6 -; CHECK-NEXT: --> (64 * (%val /u 16)) U: [0,-63) S: [-2147483648,2147483585) +; CHECK-NEXT: --> (64 * (%val /u 16)) U: [0,-63) S: [-2147483648,2147483585) ; CHECK-NEXT: Determining loop execution counts for: @shifty_biggerShr_lshrexact ; %tmp1 = lshr exact i32 %val, 4 @@ -94,9 +94,9 @@ define i32 @masky_biggerLshr(i32 %val) { ; CHECK-LABEL: 'masky_biggerLshr' ; CHECK-NEXT: Classifying expressions for: @masky_biggerLshr ; CHECK-NEXT: %tmp1 = lshr i32 %val, 2 -; CHECK-NEXT: --> (%val /u 4) U: [0,1073741824) S: [0,1073741824) +; CHECK-NEXT: --> (%val /u 4) U: [0,1073741824) S: [0,1073741824) ; CHECK-NEXT: %tmp2 = and i32 %tmp1, -16 -; CHECK-NEXT: --> (16 * (%val /u 64)) U: [0,1073741809) S: [0,1073741809) +; CHECK-NEXT: --> (16 * (%val /u 64)) U: [0,1073741809) S: [0,1073741809) ; CHECK-NEXT: Determining loop execution counts for: @masky_biggerLshr ; %tmp1 = lshr i32 %val, 2 @@ -108,7 +108,7 @@ define i32 @masky_biggerLshr_lshrexact(i32 %val) { ; CHECK-LABEL: 'masky_biggerLshr_lshrexact' ; CHECK-NEXT: Classifying expressions for: @masky_biggerLshr_lshrexact ; CHECK-NEXT: %tmp1 = lshr exact i32 %val, 2 -; CHECK-NEXT: --> (%val /u 4) U: [0,1073741824) S: [0,1073741824) +; CHECK-NEXT: --> (%val /u 4) U: [0,1073741824) S: [0,1073741824) ; CHECK-NEXT: Determining loop execution counts for: @masky_biggerLshr_lshrexact ; %tmp1 = lshr exact i32 %val, 2 @@ -119,9 +119,9 @@ define i32 @masky_biggerShr(i32 %val) { ; CHECK-LABEL: 'masky_biggerShr' ; CHECK-NEXT: Classifying expressions for: @masky_biggerShr ; CHECK-NEXT: %tmp1 = shl i32 %val, 2 -; CHECK-NEXT: --> (4 * %val) U: [0,-3) S: [-2147483648,2147483645) +; CHECK-NEXT: --> (4 * %val) U: [0,-3) S: [-2147483648,2147483645) ; CHECK-NEXT: %tmp2 = and i32 %tmp1, -64 -; CHECK-NEXT: --> (64 * (zext i26 (trunc i32 (%val /u 16) to i26) to i32)) U: [0,-63) S: [-2147483648,2147483585) +; CHECK-NEXT: --> (64 * (zext i26 (trunc i32 (%val /u 16) to i26) to i32)) U: [0,-63) S: [-2147483648,2147483585) ; CHECK-NEXT: Determining loop execution counts for: @masky_biggerShr ; %tmp1 = shl i32 %val, 2 @@ -133,7 +133,7 @@ define i32 @masky_biggerShr_lshrexact(i32 %val) { ; CHECK-LABEL: 'masky_biggerShr_lshrexact' ; CHECK-NEXT: Classifying expressions for: @masky_biggerShr_lshrexact ; CHECK-NEXT: %tmp1 = shl i32 %val, 2 -; CHECK-NEXT: --> (4 * %val) U: [0,-3) S: [-2147483648,2147483645) +; CHECK-NEXT: --> (4 * %val) U: [0,-3) S: [-2147483648,2147483645) ; CHECK-NEXT: Determining loop execution counts for: @masky_biggerShr_lshrexact ; %tmp1 = shl i32 %val, 2 diff --git a/llvm/test/Analysis/ScalarEvolution/malloc.ll b/llvm/test/Analysis/ScalarEvolution/malloc.ll index 578220cf5c37cc..3655120aba5027 100644 --- a/llvm/test/Analysis/ScalarEvolution/malloc.ll +++ b/llvm/test/Analysis/ScalarEvolution/malloc.ll @@ -27,7 +27,7 @@ define ptr @undefined_max() { ; CHECK-LABEL: 'undefined_max' ; CHECK-NEXT: Classifying expressions for: @undefined_max ; CHECK-NEXT: %alloc = call nonnull ptr @malloc(i64 -1) -; CHECK-NEXT: --> %alloc U: full-set S: full-set +; CHECK-NEXT: --> %alloc U: full-set S: full-set ; CHECK-NEXT: Determining loop execution counts for: @undefined_max ; %alloc = call nonnull ptr @malloc(i64 -1) diff --git a/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info-rewrite-expressions.ll b/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info-rewrite-expressions.ll index 49613180bad1a0..483ce64072ed60 100644 --- a/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info-rewrite-expressions.ll +++ b/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info-rewrite-expressions.ll @@ -21,7 +21,7 @@ define void @rewrite_zext(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-8 + (8 * ((zext i32 %n to i64) /u 8))) /u 8) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-8 + (8 * ((zext i32 %n to i64) /u 8))) /u 8) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %ext = zext i32 %n to i64 @@ -65,7 +65,7 @@ define i32 @rewrite_zext_min_max(i32 %N, ptr %arr) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-4 + (4 * ((16 umin (zext i32 %N to i64)) /u 4))) /u 4) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-4 + (4 * ((16 umin (zext i32 %N to i64)) /u 4))) /u 4) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %umin = call i32 @llvm.umin.i32(i32 %N, i32 16) @@ -113,7 +113,7 @@ define i32 @rewrite_min_max_zext(i32 %N, ptr %arr) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-4 + (4 * ((16 umin (zext i32 %N to i64)) /u 4))) /u 4) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-4 + (4 * ((16 umin (zext i32 %N to i64)) /u 4))) /u 4) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %N.wide = zext i32 %N to i64 @@ -161,7 +161,7 @@ define i32 @rewrite_sext_min_max(i32 %N, ptr %arr) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-4 + (4 * (zext i3 (trunc i64 ((16 smin (sext i32 %N to i64)) /u 4) to i3) to i64))) /u 4) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-4 + (4 * (zext i3 (trunc i64 ((16 smin (sext i32 %N to i64)) /u 4) to i3) to i64))) /u 4) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %smin = call i32 @llvm.smin.i32(i32 %N, i32 16) @@ -209,7 +209,7 @@ define i32 @rewrite_min_max_sext(i32 %N, ptr %arr) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-4 + (4 * (zext i3 (trunc i64 ((16 smin (sext i32 %N to i64)) /u 4) to i3) to i64))) /u 4) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-4 + (4 * (zext i3 (trunc i64 ((16 smin (sext i32 %N to i64)) /u 4) to i3) to i64))) /u 4) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %N.wide = sext i32 %N to i64 @@ -259,7 +259,7 @@ define i32 @rewrite_zext_with_info_from_icmp_ne(i32 %N) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 0 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 0 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %and = and i32 %N, 3 @@ -309,7 +309,7 @@ define i32 @rewrite_zext_no_icmp_ne(i32 %N) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-4 + (4 * ((4 + (zext i32 (-1 + (zext i2 (trunc i32 %N to i2) to i32)) to i64)) /u 4))) /u 4) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-4 + (4 * ((4 + (zext i32 (-1 + (zext i2 (trunc i32 %N to i2) to i32)) to i64)) /u 4))) /u 4) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %and = and i32 %N, 3 @@ -351,7 +351,7 @@ define void @rewrite_zext_and_base_1(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-8 + (8 * ((zext i32 %n to i64) /u 8))) /u 8) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-8 + (8 * ((zext i32 %n to i64) /u 8))) /u 8) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %ext = zext i32 %n to i64 @@ -396,7 +396,7 @@ define void @rewrite_zext_and_base_2(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-8 + (8 * ((zext i32 %n to i64) /u 8))) /u 8) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-8 + (8 * ((zext i32 %n to i64) /u 8))) /u 8) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %ext = zext i32 %n to i64 @@ -439,7 +439,7 @@ define void @guard_pessimizes_analysis_step2(i1 %c, i32 %N) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((14 + (-1 * %init)) /u 2) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((14 + (-1 * %init)) /u 2) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %N.ext = zext i32 %N to i64 @@ -487,7 +487,7 @@ define i32 @rewrite_sext_slt_narrow_check(i32 %N, ptr %arr) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-4 + (4 * (zext i3 (trunc i64 ((zext i32 (4 smax %N) to i64) /u 4) to i3) to i64))) /u 4) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-4 + (4 * (zext i3 (trunc i64 ((zext i32 (4 smax %N) to i64) /u 4) to i3) to i64))) /u 4) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %smin = call i32 @llvm.smax.i32(i32 %N, i32 4) @@ -533,7 +533,7 @@ define i32 @rewrite_zext_ult_narrow_check(i32 %N, ptr %arr) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-4 + (4 * (zext i3 (trunc i64 ((4 umax (zext i32 %N to i64)) /u 4) to i3) to i64))) /u 4) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-4 + (4 * (zext i3 (trunc i64 ((4 umax (zext i32 %N to i64)) /u 4) to i3) to i64))) /u 4) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %umin = call i32 @llvm.umax.i32(i32 %N, i32 4) @@ -579,7 +579,7 @@ define i32 @rewrite_zext_ule_narrow_check(i32 %N, ptr %arr) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-4 + (4 * (zext i3 (trunc i64 ((4 umax (zext i32 %N to i64)) /u 4) to i3) to i64))) /u 4) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-4 + (4 * (zext i3 (trunc i64 ((4 umax (zext i32 %N to i64)) /u 4) to i3) to i64))) /u 4) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %umin = call i32 @llvm.umax.i32(i32 %N, i32 4) @@ -625,7 +625,7 @@ define i32 @rewrite_zext_sle_narrow_check(i32 %N, ptr %arr) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-4 + (4 * (zext i3 (trunc i64 ((zext i32 (4 smax %N) to i64) /u 4) to i3) to i64))) /u 4) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-4 + (4 * (zext i3 (trunc i64 ((zext i32 (4 smax %N) to i64) /u 4) to i3) to i64))) /u 4) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %smin = call i32 @llvm.smax.i32(i32 %N, i32 4) @@ -671,7 +671,7 @@ define i32 @rewrite_zext_uge_narrow_check(i32 %N, ptr %arr) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-4 + (4 * ((16 umin (zext i32 %N to i64)) /u 4))) /u 4) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-4 + (4 * ((16 umin (zext i32 %N to i64)) /u 4))) /u 4) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %umin = call i32 @llvm.umin.i32(i32 %N, i32 16) @@ -717,7 +717,7 @@ define i32 @rewrite_sext_sge_narrow_check(i32 %N, ptr %arr) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-4 + (4 * (zext i3 (trunc i64 ((16 smin (sext i32 %N to i64)) /u 4) to i3) to i64))) /u 4) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-4 + (4 * (zext i3 (trunc i64 ((16 smin (sext i32 %N to i64)) /u 4) to i3) to i64))) /u 4) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %smin = call i32 @llvm.smin.i32(i32 %N, i32 16) @@ -763,7 +763,7 @@ define i32 @rewrite_zext_ugt_narrow_check(i32 %N, ptr %arr) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-4 + (4 * ((16 umin (zext i32 %N to i64)) /u 4))) /u 4) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-4 + (4 * ((16 umin (zext i32 %N to i64)) /u 4))) /u 4) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %umin = call i32 @llvm.umin.i32(i32 %N, i32 16) @@ -809,7 +809,7 @@ define i32 @rewrite_sext_sgt_narrow_check(i32 %N, ptr %arr) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-4 + (4 * (zext i3 (trunc i64 ((16 smin (sext i32 %N to i64)) /u 4) to i3) to i64))) /u 4) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-4 + (4 * (zext i3 (trunc i64 ((16 smin (sext i32 %N to i64)) /u 4) to i3) to i64))) /u 4) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %smin = call i32 @llvm.smin.i32(i32 %N, i32 16) diff --git a/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll b/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll index eb8e9dd09dc4fb..33baa996faf897 100644 --- a/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll +++ b/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll @@ -18,7 +18,7 @@ define void @test_guard_less_than_16(ptr nocapture %a, i64 %i) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (15 + (-1 * %i)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (15 + (-1 * %i)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %cmp3 = icmp ult i64 %i, 16 @@ -51,7 +51,7 @@ define void @test_guard_less_than_16_operands_swapped(ptr nocapture %a, i64 %i) ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (15 + (-1 * %i)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (15 + (-1 * %i)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %cmp3 = icmp ugt i64 16, %i @@ -84,7 +84,7 @@ define void @test_guard_less_than_16_branches_flipped(ptr nocapture %a, i64 %i) ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (15 + (-1 * %i)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (15 + (-1 * %i)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %cmp3 = icmp ult i64 %i, 16 @@ -117,7 +117,7 @@ define void @test_guard_uge_16_branches_flipped(ptr nocapture %a, i64 %i) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (15 + (-1 * %i)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (15 + (-1 * %i)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %cmp3 = icmp uge i64 %i, 16 @@ -150,7 +150,7 @@ define void @test_guard_eq_12(ptr nocapture %a, i64 %N) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %N ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %N ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 13 +; CHECK-NEXT: Loop %loop: Trip multiple is 13 ; entry: %c.1 = icmp eq i64 %N, 12 @@ -183,7 +183,7 @@ define void @test_guard_ule_12(ptr nocapture %a, i64 %N) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %N ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %N ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %c.1 = icmp ule i64 %N, 12 @@ -216,7 +216,7 @@ define void @test_guard_ule_12_step2(ptr nocapture %a, i64 %N) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%N /u 2) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%N /u 2) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %c.1 = icmp ule i64 %N, 12 @@ -249,7 +249,7 @@ define void @test_multiple_const_guards_order1(ptr nocapture %a, i64 %i) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %i ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %i ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %c.1 = icmp ult i64 %i, 16 @@ -286,7 +286,7 @@ define void @test_multiple_const_guards_order2(ptr nocapture %a, i64 %i) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %i ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %i ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %c.1 = icmp ult i64 %i, 10 @@ -323,7 +323,7 @@ define void @test_multiple_var_guards_order1(ptr nocapture %a, i64 %i, i64 %N) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %i ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %i ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %c.1 = icmp ult i64 %N, 12 @@ -360,7 +360,7 @@ define void @test_multiple_var_guards_order2(ptr nocapture %a, i64 %i, i64 %N) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %i ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %i ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %c.1 = icmp ult i64 %i, %N @@ -398,7 +398,7 @@ define void @test_multiple_var_guards_cycle(ptr nocapture %a, i64 %i, i64 %N) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %N ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %N ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %c.1 = icmp ult i64 %N, %i @@ -435,7 +435,7 @@ define void @test_guard_ult_ne(ptr nocapture readonly %data, i64 %count) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %count) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %count) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %cmp.ult = icmp ult i64 %count, 5 @@ -472,7 +472,7 @@ define void @test_guard_ne_ult(ptr nocapture readonly %data, i64 %count) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %count) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %count) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %cmp.ne = icmp ne i64 %count, 0 @@ -511,7 +511,7 @@ define void @test_guard_if_and_enter(ptr nocapture readonly %data, i64 %count) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %count) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %count) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %cmp.ult = icmp ult i64 %count, 5 @@ -548,7 +548,7 @@ define void @test_guard_if_and_skip(ptr nocapture readonly %data, i64 %count) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %count) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %count) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %cmp.ult = icmp ult i64 %count, 5 @@ -587,7 +587,7 @@ define void @test_guard_if_and_and(ptr nocapture readonly %data, i64 %count, i1 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %count) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %count) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %cmp.ult = icmp ult i64 %count, 5 @@ -627,7 +627,7 @@ define void @test_guard_if_and_or(ptr nocapture readonly %data, i64 %count, i1 % ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %count) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %count) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %cmp.ult = icmp ult i64 %count, 5 @@ -665,7 +665,7 @@ define void @test_guard_if_or_skip(ptr nocapture readonly %data, i64 %count) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %count) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %count) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %cmp.uge = icmp uge i64 %count, 5 @@ -702,7 +702,7 @@ define void @test_guard_if_or_enter(ptr nocapture readonly %data, i64 %count) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %count) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %count) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %cmp.uge = icmp uge i64 %count, 5 @@ -741,7 +741,7 @@ define void @test_guard_if_or_or(ptr nocapture readonly %data, i64 %count, i1 %c ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %count) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %count) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %cmp.uge = icmp uge i64 %count, 5 @@ -781,7 +781,7 @@ define void @test_guard_if_or_and(ptr nocapture readonly %data, i64 %count, i1 % ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %count) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %count) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %cmp.uge = icmp uge i64 %count, 5 @@ -820,7 +820,7 @@ define void @test_guard_and_assume(ptr nocapture readonly %data, i64 %count) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %count) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %count) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %cmp = icmp ult i64 %count, 5 @@ -857,7 +857,7 @@ define void @test_guard_assume_and(ptr nocapture readonly %data, i64 %count) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %count) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %count) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %cmp.ult = icmp ult i64 %count, 5 @@ -896,7 +896,7 @@ define void @guard_pessimizes_analysis_step1(i1 %c, i32 %N) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (9 + (-1 * %init)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (9 + (-1 * %init)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br i1 %c, label %bb1, label %guard @@ -937,7 +937,7 @@ define void @guard_pessimizes_analysis_step2(i1 %c, i32 %N) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((8 + (-1 * %init)) /u 2) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((8 + (-1 * %init)) /u 2) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br i1 %c, label %bb1, label %guard @@ -979,7 +979,7 @@ define void @crash(ptr %ptr) { ; CHECK-NEXT: Loop %while.body125: symbolic max backedge-taken count is {(-2 + (-1 * (ptrtoint ptr %ptr to i64))),+,-1}<%while.cond111> ; CHECK-NEXT: Loop %while.body125: Predicated backedge-taken count is {(-2 + (-1 * (ptrtoint ptr %ptr to i64))),+,-1}<%while.cond111> ; CHECK-NEXT: Predicates: -; CHECK: Loop %while.body125: Trip multiple is 1 +; CHECK-NEXT: Loop %while.body125: Trip multiple is 1 ; CHECK-NEXT: Loop %while.cond111: Unpredictable backedge-taken count. ; CHECK-NEXT: Loop %while.cond111: Unpredictable constant max backedge-taken count. ; CHECK-NEXT: Loop %while.cond111: Unpredictable symbolic max backedge-taken count. @@ -1033,7 +1033,7 @@ define void @test_guard_uge(i32 %blockSize) { ; CHECK-NEXT: Loop %while.body: symbolic max backedge-taken count is (-1 + (%blockSize /u 4)) ; CHECK-NEXT: Loop %while.body: Predicated backedge-taken count is (-1 + (%blockSize /u 4)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %while.body: Trip multiple is 1 +; CHECK-NEXT: Loop %while.body: Trip multiple is 1 ; %shr = lshr i32 %blockSize, 2 %guard = icmp uge i32 %blockSize, 4 @@ -1070,7 +1070,7 @@ define void @test_guard_ugt(i32 %blockSize) { ; CHECK-NEXT: Loop %while.body: symbolic max backedge-taken count is (-1 + (%blockSize /u 4)) ; CHECK-NEXT: Loop %while.body: Predicated backedge-taken count is (-1 + (%blockSize /u 4)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %while.body: Trip multiple is 1 +; CHECK-NEXT: Loop %while.body: Trip multiple is 1 ; %shr = lshr i32 %blockSize, 2 %guard = icmp ugt i32 %blockSize, 3 @@ -1107,7 +1107,7 @@ define void @test_guard_uge_and_ule(i32 %blockSize) { ; CHECK-NEXT: Loop %while.body: symbolic max backedge-taken count is (-1 + (%blockSize /u 4)) ; CHECK-NEXT: Loop %while.body: Predicated backedge-taken count is (-1 + (%blockSize /u 4)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %while.body: Trip multiple is 1 +; CHECK-NEXT: Loop %while.body: Trip multiple is 1 ; %shr = lshr i32 %blockSize, 2 %guard1 = icmp uge i32 %blockSize, 4 @@ -1148,7 +1148,7 @@ define void @test_guard_ugt_and_ult(i32 %blockSize) { ; CHECK-NEXT: Loop %while.body: symbolic max backedge-taken count is (-1 + (%blockSize /u 4)) ; CHECK-NEXT: Loop %while.body: Predicated backedge-taken count is (-1 + (%blockSize /u 4)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %while.body: Trip multiple is 1 +; CHECK-NEXT: Loop %while.body: Trip multiple is 1 ; %shr = lshr i32 %blockSize, 2 %guard1 = icmp ugt i32 %blockSize, 3 @@ -1191,7 +1191,7 @@ define void @test_guard_slt_sgt_1(ptr nocapture %a, i64 %N) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %N) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %N) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %c.0 = icmp slt i64 %N, 12 @@ -1228,7 +1228,7 @@ define void @test_guard_slt_sgt_2(ptr nocapture %a, i64 %i) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (17 + (-1 * %i)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (17 + (-1 * %i)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %c.0 = icmp slt i64 %i, 16 @@ -1265,7 +1265,7 @@ define void @test_guard_sle_sge_1(ptr nocapture %a, i64 %N) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %N) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %N) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %c.0 = icmp sle i64 %N, 12 @@ -1302,7 +1302,7 @@ define void @test_guard_sle_sge_2(ptr nocapture %a, i64 %i) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (17 + (-1 * %i)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (17 + (-1 * %i)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %c.0 = icmp sle i64 %i, 16 @@ -1342,7 +1342,7 @@ define void @optimized_range_check_unsigned(ptr %pred, i32 %N) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %N) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %N) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %N.off = add i32 %N, -1 @@ -1379,7 +1379,7 @@ define void @optimized_range_check_unsigned_icmp_ops_swapped(ptr %pred, i32 %N) ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %N) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %N) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %N.off = add i32 %N, -1 @@ -1418,7 +1418,7 @@ define void @optimized_range_check_unsigned2(ptr %pred, i32 %N) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %N) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %N) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %N.off = add i32 %N, -2 @@ -1458,7 +1458,7 @@ define void @optimized_range_check_unsigned3(ptr %pred, i1 %c) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %N) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %N) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %N = select i1 %c, i32 2, i32 3 @@ -1497,7 +1497,7 @@ define void @not_optimized_range_check_unsigned1(ptr %pred, i32 %N) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %N) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %N) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %N.off = add i32 %N, -1 @@ -1535,7 +1535,7 @@ define void @not_optimized_range_check_unsigned2(ptr %pred, i32 %N) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %N) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %N) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %N.off = add i32 %N, -1 @@ -1567,7 +1567,7 @@ define i32 @sle_sgt_ult_umax_to_smax(i32 %num) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-4 + %num) /u 4) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-4 + %num) /u 4) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; guard.1: %cmp.1 = icmp sle i32 %num, 0 @@ -1605,7 +1605,7 @@ define i32 @ult_sle_sgt_umax_to_smax(i32 %num) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-4 + %num) /u 4) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-4 + %num) /u 4) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; guard.1: %cmp.1 = icmp ult i32 %num, 4 @@ -1642,7 +1642,7 @@ define i32 @ptr_induction_ult_1(ptr %a, ptr %b) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 0 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 0 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %cmp.6 = icmp ult ptr %a, %b @@ -1703,7 +1703,7 @@ define void @gep_addrec_nw(ptr %a) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is 378 ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is 378 ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 379 +; CHECK-NEXT: Loop %for.body: Trip multiple is 379 ; entry: br label %for.body diff --git a/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-limit-by-wrapping.ll b/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-limit-by-wrapping.ll index 90a8b02ab7b680..9e0214e12746d8 100644 --- a/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-limit-by-wrapping.ll +++ b/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-limit-by-wrapping.ll @@ -12,7 +12,7 @@ define void @max_backedge_taken_count_by_wrapping1_nsw_nuw(i8 %N, ptr %ptr) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%N /u 4) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%N /u 4) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -37,7 +37,7 @@ define void @max_backedge_taken_count_by_wrapping1_nuw(i8 %N, ptr %ptr) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%N /u 4) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%N /u 4) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -62,7 +62,7 @@ define void @max_backedge_taken_count_by_wrapping2_nsw_nuw(i8 %N, ptr %ptr) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-64 + %N) /u 4) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-64 + %N) /u 4) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -87,7 +87,7 @@ define void @max_backedge_taken_count_by_wrapping2_nuw(i8 %N, ptr %ptr) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-64 + %N) /u 4) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-64 + %N) /u 4) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop diff --git a/llvm/test/Analysis/ScalarEvolution/max-be-count-not-constant.ll b/llvm/test/Analysis/ScalarEvolution/max-be-count-not-constant.ll index 07d16b1342c134..f91b923e4acd99 100644 --- a/llvm/test/Analysis/ScalarEvolution/max-be-count-not-constant.ll +++ b/llvm/test/Analysis/ScalarEvolution/max-be-count-not-constant.ll @@ -25,7 +25,7 @@ define void @pluto(i32 %arg) { ; CHECK-NEXT: Loop %bb2: symbolic max backedge-taken count is (1 /u (2 + %tmp)) ; CHECK-NEXT: Loop %bb2: Predicated backedge-taken count is (1 /u (2 + %tmp)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %bb2: Trip multiple is 1 +; CHECK-NEXT: Loop %bb2: Trip multiple is 1 ; bb: %tmp = ashr i32 %arg, 31 diff --git a/llvm/test/Analysis/ScalarEvolution/max-expr-cache.ll b/llvm/test/Analysis/ScalarEvolution/max-expr-cache.ll index 6aaf55dba10224..d401ff31035e8f 100644 --- a/llvm/test/Analysis/ScalarEvolution/max-expr-cache.ll +++ b/llvm/test/Analysis/ScalarEvolution/max-expr-cache.ll @@ -92,7 +92,7 @@ define void @smax(i32 %tmp3) { ; CHECK-NEXT: Loop %bb53: symbolic max backedge-taken count is (-1 + (zext i32 (0 smax %tmp49) to i64) + (-1 * undef)) ; CHECK-NEXT: Loop %bb53: Predicated backedge-taken count is (-1 + (zext i32 (0 smax %tmp49) to i64) + (-1 * undef)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %bb53: Trip multiple is 1 +; CHECK-NEXT: Loop %bb53: Trip multiple is 1 ; CHECK-NEXT: Loop %bb4: Unpredictable backedge-taken count. ; CHECK-NEXT: Loop %bb4: Unpredictable constant max backedge-taken count. ; CHECK-NEXT: Loop %bb4: Unpredictable symbolic max backedge-taken count. @@ -254,7 +254,7 @@ define void @umax(i32 %tmp3) { ; CHECK-NEXT: Loop %bb53: symbolic max backedge-taken count is (-1 + (zext i32 %tmp49 to i64) + (-1 * undef)) ; CHECK-NEXT: Loop %bb53: Predicated backedge-taken count is (-1 + (zext i32 %tmp49 to i64) + (-1 * undef)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %bb53: Trip multiple is 1 +; CHECK-NEXT: Loop %bb53: Trip multiple is 1 ; CHECK-NEXT: Loop %bb4: Unpredictable backedge-taken count. ; CHECK-NEXT: Loop %bb4: Unpredictable constant max backedge-taken count. ; CHECK-NEXT: Loop %bb4: Unpredictable symbolic max backedge-taken count. diff --git a/llvm/test/Analysis/ScalarEvolution/min-max-exprs.ll b/llvm/test/Analysis/ScalarEvolution/min-max-exprs.ll index d65da6fc7e5ac9..bc0c05aafc6b36 100644 --- a/llvm/test/Analysis/ScalarEvolution/min-max-exprs.ll +++ b/llvm/test/Analysis/ScalarEvolution/min-max-exprs.ll @@ -51,7 +51,7 @@ define void @f(ptr %A, i32 %N) { ; CHECK-NEXT: Loop %bb1: symbolic max backedge-taken count is (0 smax %N) ; CHECK-NEXT: Loop %bb1: Predicated backedge-taken count is (0 smax %N) ; CHECK-NEXT: Predicates: -; CHECK: Loop %bb1: Trip multiple is 1 +; CHECK-NEXT: Loop %bb1: Trip multiple is 1 ; bb: br label %bb1 diff --git a/llvm/test/Analysis/ScalarEvolution/ne-overflow.ll b/llvm/test/Analysis/ScalarEvolution/ne-overflow.ll index cca56bcd6c3b83..6ae241c85f6502 100644 --- a/llvm/test/Analysis/ScalarEvolution/ne-overflow.ll +++ b/llvm/test/Analysis/ScalarEvolution/ne-overflow.ll @@ -15,7 +15,7 @@ define void @test(i32 %N) mustprogress { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is ((-2 + %N) /u 2) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is ((-2 + %N) /u 2) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; entry: br label %for.body @@ -38,7 +38,7 @@ define void @test_preinc(i32 %N) mustprogress { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (%N /u 2) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (%N /u 2) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; entry: br label %for.body @@ -131,7 +131,7 @@ define void @test_1024(i32 %N) mustprogress { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is ((-1024 + %N) /u 1024) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is ((-1024 + %N) /u 1024) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; entry: br label %for.body @@ -154,7 +154,7 @@ define void @test_uneven_divide(i32 %N) mustprogress { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + (-1431655765 * %N)) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + (-1431655765 * %N)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; entry: br label %for.body @@ -253,7 +253,7 @@ define void @test_zext(i64 %N) mustprogress { ; CHECK-NEXT: Loop %for.body: Unpredictable symbolic max backedge-taken count. ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (%N /u 2) ; CHECK-NEXT: Predicates: -; CHECK-NEXT: {0,+,2}<%for.body> Added Flags: +; CHECK-NEXT: {0,+,2}<%for.body> Added Flags: ; entry: br label %for.body diff --git a/llvm/test/Analysis/ScalarEvolution/no-wrap-symbolic-becount.ll b/llvm/test/Analysis/ScalarEvolution/no-wrap-symbolic-becount.ll index b44be462067cc2..1831d81cc99fe6 100644 --- a/llvm/test/Analysis/ScalarEvolution/no-wrap-symbolic-becount.ll +++ b/llvm/test/Analysis/ScalarEvolution/no-wrap-symbolic-becount.ll @@ -78,7 +78,7 @@ define i32 @test_02(i32 %start, ptr %p, ptr %q) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (9223372036854775806 + (2147483648 * (zext i32 %start to i64))) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (9223372036854775806 + (2147483648 * (zext i32 %start to i64))) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %zext = zext i32 %start to i64 @@ -139,7 +139,7 @@ define void @pointer_iv_nowrap_guard(ptr %startptr, ptr %endptr) local_unnamed_a ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-8001 + (-1 * (ptrtoint ptr %startptr to i64)) + ((8004 + (ptrtoint ptr %startptr to i64)) umax (ptrtoint ptr %endptr to i64))) /u 4) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-8001 + (-1 * (ptrtoint ptr %startptr to i64)) + ((8004 + (ptrtoint ptr %startptr to i64)) umax (ptrtoint ptr %endptr to i64))) /u 4) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %init = getelementptr inbounds i32, ptr %startptr, i64 2000 diff --git a/llvm/test/Analysis/ScalarEvolution/nsw-offset-assume.ll b/llvm/test/Analysis/ScalarEvolution/nsw-offset-assume.ll index 117f249704d992..bc308f258dd1d0 100644 --- a/llvm/test/Analysis/ScalarEvolution/nsw-offset-assume.ll +++ b/llvm/test/Analysis/ScalarEvolution/nsw-offset-assume.ll @@ -49,7 +49,7 @@ define void @foo(i32 %no, ptr nocapture %d, ptr nocapture %q) nounwind { ; CHECK-NEXT: Loop %bb: symbolic max backedge-taken count is ((-1 + (2 * (%no /u 2))) /u 2) ; CHECK-NEXT: Loop %bb: Predicated backedge-taken count is ((-1 + (2 * (%no /u 2))) /u 2) ; CHECK-NEXT: Predicates: -; CHECK: Loop %bb: Trip multiple is 1 +; CHECK-NEXT: Loop %bb: Trip multiple is 1 ; entry: %n = and i32 %no, 4294967294 diff --git a/llvm/test/Analysis/ScalarEvolution/nsw-offset.ll b/llvm/test/Analysis/ScalarEvolution/nsw-offset.ll index 4e9e91d294e20c..51b8db67680488 100644 --- a/llvm/test/Analysis/ScalarEvolution/nsw-offset.ll +++ b/llvm/test/Analysis/ScalarEvolution/nsw-offset.ll @@ -46,7 +46,7 @@ define void @foo(i32 %no, ptr nocapture %d, ptr nocapture %q) nounwind { ; CHECK-NEXT: Loop %bb: symbolic max backedge-taken count is ((-1 + (2 * (%no /u 2))) /u 2) ; CHECK-NEXT: Loop %bb: Predicated backedge-taken count is ((-1 + (2 * (%no /u 2))) /u 2) ; CHECK-NEXT: Predicates: -; CHECK: Loop %bb: Trip multiple is 1 +; CHECK-NEXT: Loop %bb: Trip multiple is 1 ; entry: %n = and i32 %no, 4294967294 diff --git a/llvm/test/Analysis/ScalarEvolution/nsw.ll b/llvm/test/Analysis/ScalarEvolution/nsw.ll index 031ec46edcdaca..5c4c9fcd8a0d55 100644 --- a/llvm/test/Analysis/ScalarEvolution/nsw.ll +++ b/llvm/test/Analysis/ScalarEvolution/nsw.ll @@ -81,7 +81,7 @@ define void @test2(ptr %begin, ptr %end) ssp { ; CHECK-NEXT: Loop %for.body.i.i: symbolic max backedge-taken count is ((-4 + (-1 * (ptrtoint ptr %begin to i64)) + (ptrtoint ptr %end to i64)) /u 4) ; CHECK-NEXT: Loop %for.body.i.i: Predicated backedge-taken count is ((-4 + (-1 * (ptrtoint ptr %begin to i64)) + (ptrtoint ptr %end to i64)) /u 4) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body.i.i: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body.i.i: Trip multiple is 1 ; entry: %cmp1.i.i = icmp eq ptr %begin, %end @@ -122,7 +122,7 @@ define void @test3(ptr %begin, ptr %end) nounwind ssp { ; CHECK-NEXT: Loop %for.body.i.i: symbolic max backedge-taken count is ((-4 + (-1 * (ptrtoint ptr %begin to i64)) + (ptrtoint ptr %end to i64)) /u 4) ; CHECK-NEXT: Loop %for.body.i.i: Predicated backedge-taken count is ((-4 + (-1 * (ptrtoint ptr %begin to i64)) + (ptrtoint ptr %end to i64)) /u 4) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body.i.i: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body.i.i: Trip multiple is 1 ; entry: %cmp7.i.i = icmp eq ptr %begin, %end @@ -185,7 +185,7 @@ define i32 @PR12375(ptr readnone %arg) { ; CHECK-NEXT: Loop %bb1: symbolic max backedge-taken count is 1 ; CHECK-NEXT: Loop %bb1: Predicated backedge-taken count is 1 ; CHECK-NEXT: Predicates: -; CHECK: Loop %bb1: Trip multiple is 2 +; CHECK-NEXT: Loop %bb1: Trip multiple is 2 ; bb: %tmp = getelementptr inbounds i32, ptr %arg, i64 2 @@ -216,7 +216,7 @@ define void @PR12376(ptr nocapture %arg, ptr nocapture %arg1) { ; CHECK-NEXT: Loop %bb2: symbolic max backedge-taken count is ((-1 + (-1 * (ptrtoint ptr %arg to i64)) + ((4 + (ptrtoint ptr %arg to i64)) umax (ptrtoint ptr %arg1 to i64))) /u 4) ; CHECK-NEXT: Loop %bb2: Predicated backedge-taken count is ((-1 + (-1 * (ptrtoint ptr %arg to i64)) + ((4 + (ptrtoint ptr %arg to i64)) umax (ptrtoint ptr %arg1 to i64))) /u 4) ; CHECK-NEXT: Predicates: -; CHECK: Loop %bb2: Trip multiple is 1 +; CHECK-NEXT: Loop %bb2: Trip multiple is 1 ; bb: br label %bb2 @@ -252,7 +252,7 @@ define void @nswnowrap(i32 %v, ptr %buf) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is ((-1 * %v) + ((1 + %v) smax %v)), actual taken count either this or zero. ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is ((-1 * %v) + ((1 + %v) smax %v)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; entry: %add = add nsw i32 %v, 1 @@ -295,7 +295,7 @@ define void @test4(i32 %arg) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + (-1 * %arg) + (10 smax (1 + %arg))) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + (-1 * %arg) + (10 smax (1 + %arg))) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; entry: %array = alloca [10 x i32], align 4 @@ -329,7 +329,7 @@ define void @bad_postinc_nsw_a(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((((-1 * (1 umin %n)) + %n) /u 7) + (1 umin %n)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((((-1 * (1 umin %n)) + %n) /u 7) + (1 umin %n)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -390,7 +390,7 @@ define void @pr28012(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-1 + (7 umax %n)) /u 7) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-1 + (7 umax %n)) /u 7) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -455,7 +455,7 @@ define void @pr66066() { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 1 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 1 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 2 +; CHECK-NEXT: Loop %loop: Trip multiple is 2 ; entry: br label %loop diff --git a/llvm/test/Analysis/ScalarEvolution/overflow-intrinsics-trip-count.ll b/llvm/test/Analysis/ScalarEvolution/overflow-intrinsics-trip-count.ll index 29c345637dd6f5..769db5ae0d5b58 100644 --- a/llvm/test/Analysis/ScalarEvolution/overflow-intrinsics-trip-count.ll +++ b/llvm/test/Analysis/ScalarEvolution/overflow-intrinsics-trip-count.ll @@ -16,7 +16,7 @@ define void @uadd_exhaustive() { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is 35 ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is 35 ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 36 +; CHECK-NEXT: Loop %for.body: Trip multiple is 36 ; entry: br i1 undef, label %for.end, label %for.body.preheader @@ -43,7 +43,7 @@ define void @sadd_exhaustive() { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is 67 ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is 67 ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 68 +; CHECK-NEXT: Loop %for.body: Trip multiple is 68 ; entry: br i1 undef, label %for.end, label %for.body.preheader @@ -70,7 +70,7 @@ define void @usub_exhaustive() { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is 50 ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is 50 ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 51 +; CHECK-NEXT: Loop %for.body: Trip multiple is 51 ; entry: br i1 undef, label %for.end, label %for.body.preheader @@ -97,7 +97,7 @@ define void @ssub_exhaustive() { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is 68 ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is 68 ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 69 +; CHECK-NEXT: Loop %for.body: Trip multiple is 69 ; entry: br i1 undef, label %for.end, label %for.body.preheader @@ -124,7 +124,7 @@ define void @smul_exhaustive() { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is 14 ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is 14 ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 15 +; CHECK-NEXT: Loop %for.body: Trip multiple is 15 ; entry: br i1 undef, label %for.end, label %for.body.preheader @@ -151,7 +151,7 @@ define void @umul_exhaustive() { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is 15 ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is 15 ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 16 +; CHECK-NEXT: Loop %for.body: Trip multiple is 16 ; entry: br i1 undef, label %for.end, label %for.body.preheader @@ -178,7 +178,7 @@ define void @uadd_symbolic_start(i16 %start) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + (-1 * %start)) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + (-1 * %start)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; entry: br i1 undef, label %for.end, label %for.body.preheader @@ -205,7 +205,7 @@ define void @sadd_symbolic_start(i16 %start) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (32767 + (-1 * %start)) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (32767 + (-1 * %start)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; entry: br i1 undef, label %for.end, label %for.body.preheader @@ -283,7 +283,7 @@ define void @usub_symbolic_start(i16 %start) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is %start ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is %start ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; entry: br i1 undef, label %for.end, label %for.body.preheader @@ -310,7 +310,7 @@ define void @ssub_symbolic_start(i16 %start) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-32768 + %start) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-32768 + %start) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; entry: br i1 undef, label %for.end, label %for.body.preheader @@ -391,7 +391,7 @@ define void @sadd_symbolic_non_latch(i16 %start) { ; CHECK-NEXT: symbolic max exit count for for.latch: (230 + (-1 * %start)) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is ((230 + (-1 * %start)) umin (32767 + (-1 * %start))) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; entry: br i1 undef, label %for.end, label %for.body.preheader diff --git a/llvm/test/Analysis/ScalarEvolution/predicated-trip-count.ll b/llvm/test/Analysis/ScalarEvolution/predicated-trip-count.ll index 7764cf45df6b87..72f3c11d9c853f 100644 --- a/llvm/test/Analysis/ScalarEvolution/predicated-trip-count.ll +++ b/llvm/test/Analysis/ScalarEvolution/predicated-trip-count.ll @@ -35,7 +35,7 @@ define void @test1(i32 %N, i32 %M) { ; CHECK-NEXT: Loop %bb3: Unpredictable symbolic max backedge-taken count. ; CHECK-NEXT: Loop %bb3: Predicated backedge-taken count is (1 + (-1 smax %M)) ; CHECK-NEXT: Predicates: -; CHECK-NEXT: {0,+,1}<%bb3> Added Flags: +; CHECK-NEXT: {0,+,1}<%bb3> Added Flags: ; entry: br label %bb3 @@ -102,7 +102,7 @@ define void @test2(i32 %N, i32 %M, i16 %Start) { ; CHECK-NEXT: Loop %bb3: Unpredictable symbolic max backedge-taken count. ; CHECK-NEXT: Loop %bb3: Predicated backedge-taken count is (1 + (sext i16 %Start to i32) + (-1 * ((1 + (sext i16 %Start to i32)) smin %M))) ; CHECK-NEXT: Predicates: -; CHECK-NEXT: {%Start,+,-1}<%bb3> Added Flags: +; CHECK-NEXT: {%Start,+,-1}<%bb3> Added Flags: ; entry: br label %bb3 diff --git a/llvm/test/Analysis/ScalarEvolution/ptrtoint.ll b/llvm/test/Analysis/ScalarEvolution/ptrtoint.ll index 6331035d1e4c4e..4451b7ee6bac06 100644 --- a/llvm/test/Analysis/ScalarEvolution/ptrtoint.ll +++ b/llvm/test/Analysis/ScalarEvolution/ptrtoint.ll @@ -233,7 +233,7 @@ define void @ptrtoint_of_addrec(ptr %in, i32 %count) { ; X64-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + (zext i32 %count to i64)) ; X64-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + (zext i32 %count to i64)) ; X64-NEXT: Predicates: -; X64: Loop %loop: Trip multiple is 1 +; X64-NEXT: Loop %loop: Trip multiple is 1 ; ; X32-LABEL: 'ptrtoint_of_addrec' ; X32-NEXT: Classifying expressions for: @ptrtoint_of_addrec @@ -253,7 +253,7 @@ define void @ptrtoint_of_addrec(ptr %in, i32 %count) { ; X32-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + (zext i32 %count to i64)) ; X32-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + (zext i32 %count to i64)) ; X32-NEXT: Predicates: -; X32: Loop %loop: Trip multiple is 1 +; X32-NEXT: Loop %loop: Trip multiple is 1 ; entry: %i3 = zext i32 %count to i64 @@ -401,7 +401,7 @@ define void @pr46786_c26_char(ptr %arg, ptr %arg1, ptr %arg2) { ; X64-NEXT: Loop %bb6: symbolic max backedge-taken count is (-1 + (-1 * (ptrtoint ptr %arg to i64)) + (ptrtoint ptr %arg1 to i64)) ; X64-NEXT: Loop %bb6: Predicated backedge-taken count is (-1 + (-1 * (ptrtoint ptr %arg to i64)) + (ptrtoint ptr %arg1 to i64)) ; X64-NEXT: Predicates: -; X64: Loop %bb6: Trip multiple is 1 +; X64-NEXT: Loop %bb6: Trip multiple is 1 ; ; X32-LABEL: 'pr46786_c26_char' ; X32-NEXT: Classifying expressions for: @pr46786_c26_char @@ -429,7 +429,7 @@ define void @pr46786_c26_char(ptr %arg, ptr %arg1, ptr %arg2) { ; X32-NEXT: Loop %bb6: symbolic max backedge-taken count is (-1 + (-1 * (ptrtoint ptr %arg to i32)) + (ptrtoint ptr %arg1 to i32)) ; X32-NEXT: Loop %bb6: Predicated backedge-taken count is (-1 + (-1 * (ptrtoint ptr %arg to i32)) + (ptrtoint ptr %arg1 to i32)) ; X32-NEXT: Predicates: -; X32: Loop %bb6: Trip multiple is 1 +; X32-NEXT: Loop %bb6: Trip multiple is 1 ; %i = icmp eq ptr %arg, %arg1 br i1 %i, label %bb5, label %bb3 @@ -490,7 +490,7 @@ define void @pr46786_c26_int(ptr %arg, ptr %arg1, ptr %arg2) { ; X64-NEXT: Loop %bb6: symbolic max backedge-taken count is ((-4 + (-1 * (ptrtoint ptr %arg to i64)) + (ptrtoint ptr %arg1 to i64)) /u 4) ; X64-NEXT: Loop %bb6: Predicated backedge-taken count is ((-4 + (-1 * (ptrtoint ptr %arg to i64)) + (ptrtoint ptr %arg1 to i64)) /u 4) ; X64-NEXT: Predicates: -; X64: Loop %bb6: Trip multiple is 1 +; X64-NEXT: Loop %bb6: Trip multiple is 1 ; ; X32-LABEL: 'pr46786_c26_int' ; X32-NEXT: Classifying expressions for: @pr46786_c26_int @@ -520,7 +520,7 @@ define void @pr46786_c26_int(ptr %arg, ptr %arg1, ptr %arg2) { ; X32-NEXT: Loop %bb6: symbolic max backedge-taken count is ((-4 + (-1 * (ptrtoint ptr %arg to i32)) + (ptrtoint ptr %arg1 to i32)) /u 4) ; X32-NEXT: Loop %bb6: Predicated backedge-taken count is ((-4 + (-1 * (ptrtoint ptr %arg to i32)) + (ptrtoint ptr %arg1 to i32)) /u 4) ; X32-NEXT: Predicates: -; X32: Loop %bb6: Trip multiple is 1 +; X32-NEXT: Loop %bb6: Trip multiple is 1 ; %i = icmp eq ptr %arg, %arg1 br i1 %i, label %bb5, label %bb3 diff --git a/llvm/test/Analysis/ScalarEvolution/range-signedness.ll b/llvm/test/Analysis/ScalarEvolution/range-signedness.ll index 7022892dea7152..119bfc39afe699 100644 --- a/llvm/test/Analysis/ScalarEvolution/range-signedness.ll +++ b/llvm/test/Analysis/ScalarEvolution/range-signedness.ll @@ -44,7 +44,7 @@ define void @y(ptr %addr) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 10 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 10 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 11 +; CHECK-NEXT: Loop %loop: Trip multiple is 11 ; entry: br label %loop diff --git a/llvm/test/Analysis/ScalarEvolution/range_nw_flag.ll b/llvm/test/Analysis/ScalarEvolution/range_nw_flag.ll index a69480d7b01e1f..1272975406f761 100644 --- a/llvm/test/Analysis/ScalarEvolution/range_nw_flag.ll +++ b/llvm/test/Analysis/ScalarEvolution/range_nw_flag.ll @@ -19,7 +19,7 @@ define void @test-add-nuw(ptr %input, i32 %offset, i32 %numIterations) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -55,7 +55,7 @@ define void @test-addrec-nuw(ptr %input, i32 %offset, i32 %numIterations) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %cmp = icmp sgt i32 %offset, 10 @@ -93,7 +93,7 @@ define void @test-addrec-nsw-start-neg-strip-neg(ptr %input, i32 %offset, i32 %n ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + (-1 * %numIterations)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + (-1 * %numIterations)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %cmp = icmp slt i32 %offset, -10 @@ -131,7 +131,7 @@ define void @test-addrec-nsw-start-pos-strip-neg(ptr %input, i32 %offset, i32 %n ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + (-1 * %numIterations)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + (-1 * %numIterations)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %cmp = icmp slt i32 %offset, 10 @@ -169,7 +169,7 @@ define void @test-addrec-nsw-start-pos-strip-pos(ptr %input, i32 %offset, i32 %n ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %cmp = icmp sgt i32 %offset, 10 @@ -207,7 +207,7 @@ define void @test-addrec-nsw-start-neg-strip-pos(ptr %input, i32 %offset, i32 %n ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %numIterations) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %cmp = icmp sgt i32 %offset, -10 diff --git a/llvm/test/Analysis/ScalarEvolution/ranges.ll b/llvm/test/Analysis/ScalarEvolution/ranges.ll index d42abac1971fb0..3b43c525d2ce90 100644 --- a/llvm/test/Analysis/ScalarEvolution/ranges.ll +++ b/llvm/test/Analysis/ScalarEvolution/ranges.ll @@ -140,7 +140,7 @@ define void @add_6(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((((-1 * (1 umin %n)) + %n) /u 6) + (1 umin %n)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((((-1 * (1 umin %n)) + %n) /u 6) + (1 umin %n)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -167,7 +167,7 @@ define void @add_7(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((((-1 * (1 umin %n)) + %n) /u 7) + (1 umin %n)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((((-1 * (1 umin %n)) + %n) /u 7) + (1 umin %n)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -194,7 +194,7 @@ define void @add_8(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((7 + %n) /u 8) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((7 + %n) /u 8) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -222,7 +222,7 @@ define void @add_9(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((((-1 * (1 umin %n)) + %n) /u 9) + (1 umin %n)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((((-1 * (1 umin %n)) + %n) /u 9) + (1 umin %n)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -250,7 +250,7 @@ define void @add_10(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((((-1 * (1 umin %n)) + %n) /u 10) + (1 umin %n)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((((-1 * (1 umin %n)) + %n) /u 10) + (1 umin %n)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -515,7 +515,7 @@ define void @truncate(i16 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((((-1 * (1 umin %n)) + %n) /u 9) + (1 umin %n)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((((-1 * (1 umin %n)) + %n) /u 9) + (1 umin %n)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop diff --git a/llvm/test/Analysis/ScalarEvolution/sdiv.ll b/llvm/test/Analysis/ScalarEvolution/sdiv.ll index dcd10a82a2e2ac..3d4aaa29536e78 100644 --- a/llvm/test/Analysis/ScalarEvolution/sdiv.ll +++ b/llvm/test/Analysis/ScalarEvolution/sdiv.ll @@ -35,7 +35,7 @@ define dso_local void @_Z4loopi(i32 %width) local_unnamed_addr #0 { ; CHECK-NEXT: Loop %for.cond: symbolic max backedge-taken count is %width ; CHECK-NEXT: Loop %for.cond: Predicated backedge-taken count is %width ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.cond: Trip multiple is 1 +; CHECK-NEXT: Loop %for.cond: Trip multiple is 1 ; entry: %storage = alloca [2 x i32], align 4 diff --git a/llvm/test/Analysis/ScalarEvolution/sext-add-inreg-loop.ll b/llvm/test/Analysis/ScalarEvolution/sext-add-inreg-loop.ll index 92becb7995919f..1345aa4e641176 100644 --- a/llvm/test/Analysis/ScalarEvolution/sext-add-inreg-loop.ll +++ b/llvm/test/Analysis/ScalarEvolution/sext-add-inreg-loop.ll @@ -28,7 +28,7 @@ define dso_local i32 @test_loop(ptr nocapture noundef readonly %x) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is 8 ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is 8 ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 9 +; CHECK-NEXT: Loop %for.body: Trip multiple is 9 ; entry: br label %for.body diff --git a/llvm/test/Analysis/ScalarEvolution/sext-mul.ll b/llvm/test/Analysis/ScalarEvolution/sext-mul.ll index 082e9269442385..a31789c5ee3f77 100644 --- a/llvm/test/Analysis/ScalarEvolution/sext-mul.ll +++ b/llvm/test/Analysis/ScalarEvolution/sext-mul.ll @@ -34,7 +34,7 @@ define void @foo(ptr nocapture %arg, i32 %arg1, i32 %arg2) { ; CHECK-NEXT: Loop %bb7: symbolic max backedge-taken count is (-1 + (zext i32 %arg2 to i64)) ; CHECK-NEXT: Loop %bb7: Predicated backedge-taken count is (-1 + (zext i32 %arg2 to i64)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %bb7: Trip multiple is 1 +; CHECK-NEXT: Loop %bb7: Trip multiple is 1 ; bb: %tmp = icmp sgt i32 %arg2, 0 @@ -101,7 +101,7 @@ define void @goo(ptr nocapture %arg3, i32 %arg4, i32 %arg5) { ; CHECK-NEXT: Loop %bb7: symbolic max backedge-taken count is (-1 + (zext i32 %arg5 to i128)) ; CHECK-NEXT: Loop %bb7: Predicated backedge-taken count is (-1 + (zext i32 %arg5 to i128)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %bb7: Trip multiple is 1 +; CHECK-NEXT: Loop %bb7: Trip multiple is 1 ; bb: %t = icmp sgt i32 %arg5, 0 diff --git a/llvm/test/Analysis/ScalarEvolution/sext-to-zext.ll b/llvm/test/Analysis/ScalarEvolution/sext-to-zext.ll index 2eca58b32483b1..18f20c37178984 100644 --- a/llvm/test/Analysis/ScalarEvolution/sext-to-zext.ll +++ b/llvm/test/Analysis/ScalarEvolution/sext-to-zext.ll @@ -24,7 +24,7 @@ define void @f(i1 %c) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 99 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 99 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 100 +; CHECK-NEXT: Loop %loop: Trip multiple is 100 ; entry: %start = select i1 %c, i32 100, i32 0 diff --git a/llvm/test/Analysis/ScalarEvolution/shift-recurrences.ll b/llvm/test/Analysis/ScalarEvolution/shift-recurrences.ll index 3301af14788604..bbb1f46197a809 100644 --- a/llvm/test/Analysis/ScalarEvolution/shift-recurrences.ll +++ b/llvm/test/Analysis/ScalarEvolution/shift-recurrences.ll @@ -211,7 +211,7 @@ define void @test_shl2() { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 4 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 4 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 5 +; CHECK-NEXT: Loop %loop: Trip multiple is 5 ; entry: br label %loop @@ -246,7 +246,7 @@ define void @test_shl3(i1 %c) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 4 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 4 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 5 +; CHECK-NEXT: Loop %loop: Trip multiple is 5 ; entry: %shiftamt = select i1 %c, i64 1, i64 0 @@ -280,7 +280,7 @@ define void @test_shl4() { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 60 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 60 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 61 +; CHECK-NEXT: Loop %loop: Trip multiple is 61 ; entry: br label %loop @@ -313,7 +313,7 @@ define void @test_shl5() { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 61 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 61 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 62 +; CHECK-NEXT: Loop %loop: Trip multiple is 62 ; entry: br label %loop @@ -348,7 +348,7 @@ define void @test_shl6(i1 %c) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 4 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 4 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 5 +; CHECK-NEXT: Loop %loop: Trip multiple is 5 ; entry: br label %loop @@ -382,7 +382,7 @@ define void @test_shl7(i1 %c, i64 %shiftamt) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 4 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 4 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 5 +; CHECK-NEXT: Loop %loop: Trip multiple is 5 ; entry: br label %loop @@ -529,7 +529,7 @@ define void @test_ashr_tc_positive() { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 4 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 4 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 5 +; CHECK-NEXT: Loop %loop: Trip multiple is 5 ; entry: br label %loop @@ -561,7 +561,7 @@ define void @test_ashr_tc_negative() { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 4 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 4 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 5 +; CHECK-NEXT: Loop %loop: Trip multiple is 5 ; entry: br label %loop @@ -595,7 +595,7 @@ define void @test_ashr_tc_either(i1 %a) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 60 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 60 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 61 +; CHECK-NEXT: Loop %loop: Trip multiple is 61 ; entry: %start = sext i1 %a to i8 @@ -628,7 +628,7 @@ define void @test_ashr_zero_shift() { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 4 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 4 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 5 +; CHECK-NEXT: Loop %loop: Trip multiple is 5 ; entry: br label %loop @@ -660,7 +660,7 @@ define void @test_lshr_tc_positive() { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 4 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 4 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 5 +; CHECK-NEXT: Loop %loop: Trip multiple is 5 ; entry: br label %loop @@ -692,7 +692,7 @@ define void @test_lshr_tc_negative() { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 4 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 4 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 5 +; CHECK-NEXT: Loop %loop: Trip multiple is 5 ; entry: br label %loop @@ -726,7 +726,7 @@ define void @test_lshr_tc_either(i1 %a) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 4 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 4 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 5 +; CHECK-NEXT: Loop %loop: Trip multiple is 5 ; entry: %start = sext i1 %a to i8 @@ -759,7 +759,7 @@ define void @test_lshr_zero_shift() { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 4 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 4 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 5 +; CHECK-NEXT: Loop %loop: Trip multiple is 5 ; entry: br label %loop @@ -792,7 +792,7 @@ define void @test_lshr_power_of_2_start() { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 4 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 4 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 5 +; CHECK-NEXT: Loop %loop: Trip multiple is 5 ; entry: br label %loop @@ -825,7 +825,7 @@ define void @test_lshr_arbitrary_start() { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 4 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 4 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 5 +; CHECK-NEXT: Loop %loop: Trip multiple is 5 ; entry: br label %loop @@ -857,7 +857,7 @@ define void @test_lshr_start_power_of_2_plus_one() { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 4 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 4 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 5 +; CHECK-NEXT: Loop %loop: Trip multiple is 5 ; entry: br label %loop diff --git a/llvm/test/Analysis/ScalarEvolution/shl-lshr-differentconstmask.ll b/llvm/test/Analysis/ScalarEvolution/shl-lshr-differentconstmask.ll index c9ecaeaeaabf15..c2402f7626e3d5 100644 --- a/llvm/test/Analysis/ScalarEvolution/shl-lshr-differentconstmask.ll +++ b/llvm/test/Analysis/ScalarEvolution/shl-lshr-differentconstmask.ll @@ -6,9 +6,9 @@ define i32 @mul_biggerShl(i32 %val) nounwind { ; CHECK-LABEL: 'mul_biggerShl' ; CHECK-NEXT: Classifying expressions for: @mul_biggerShl ; CHECK-NEXT: %tmp1 = mul i32 %val, 64 -; CHECK-NEXT: --> (64 * %val) U: [0,-63) S: [-2147483648,2147483585) +; CHECK-NEXT: --> (64 * %val) U: [0,-63) S: [-2147483648,2147483585) ; CHECK-NEXT: %tmp2 = udiv i32 %tmp1, 16 -; CHECK-NEXT: --> ((64 * %val) /u 16) U: [0,268435453) S: [0,268435456) +; CHECK-NEXT: --> ((64 * %val) /u 16) U: [0,268435453) S: [0,268435456) ; CHECK-NEXT: Determining loop execution counts for: @mul_biggerShl ; %tmp1 = mul i32 %val, 64 @@ -20,9 +20,9 @@ define i32 @mul_biggerLshl(i32 %val) nounwind { ; CHECK-LABEL: 'mul_biggerLshl' ; CHECK-NEXT: Classifying expressions for: @mul_biggerLshl ; CHECK-NEXT: %tmp1 = mul i32 %val, 16 -; CHECK-NEXT: --> (16 * %val) U: [0,-15) S: [-2147483648,2147483633) +; CHECK-NEXT: --> (16 * %val) U: [0,-15) S: [-2147483648,2147483633) ; CHECK-NEXT: %tmp2 = udiv i32 %tmp1, 64 -; CHECK-NEXT: --> ((16 * %val) /u 64) U: [0,67108864) S: [0,67108864) +; CHECK-NEXT: --> ((16 * %val) /u 64) U: [0,67108864) S: [0,67108864) ; CHECK-NEXT: Determining loop execution counts for: @mul_biggerLshl ; %tmp1 = mul i32 %val, 16 @@ -36,9 +36,9 @@ define i32 @shifty_biggerShl(i32 %val) { ; CHECK-LABEL: 'shifty_biggerShl' ; CHECK-NEXT: Classifying expressions for: @shifty_biggerShl ; CHECK-NEXT: %tmp1 = shl i32 %val, 6 -; CHECK-NEXT: --> (64 * %val) U: [0,-63) S: [-2147483648,2147483585) +; CHECK-NEXT: --> (64 * %val) U: [0,-63) S: [-2147483648,2147483585) ; CHECK-NEXT: %tmp2 = lshr i32 %tmp1, 4 -; CHECK-NEXT: --> ((64 * %val) /u 16) U: [0,268435453) S: [0,268435456) +; CHECK-NEXT: --> ((64 * %val) /u 16) U: [0,268435453) S: [0,268435456) ; CHECK-NEXT: Determining loop execution counts for: @shifty_biggerShl ; %tmp1 = shl i32 %val, 6 @@ -50,9 +50,9 @@ define i32 @shifty_biggerShl_shlnuw(i32 %val) { ; CHECK-LABEL: 'shifty_biggerShl_shlnuw' ; CHECK-NEXT: Classifying expressions for: @shifty_biggerShl_shlnuw ; CHECK-NEXT: %tmp1 = shl nuw i32 %val, 6 -; CHECK-NEXT: --> (64 * %val) U: [0,-63) S: [-2147483648,2147483585) +; CHECK-NEXT: --> (64 * %val) U: [0,-63) S: [-2147483648,2147483585) ; CHECK-NEXT: %tmp2 = lshr i32 %tmp1, 4 -; CHECK-NEXT: --> ((64 * %val) /u 16) U: [0,268435453) S: [0,268435456) +; CHECK-NEXT: --> ((64 * %val) /u 16) U: [0,268435453) S: [0,268435456) ; CHECK-NEXT: Determining loop execution counts for: @shifty_biggerShl_shlnuw ; %tmp1 = shl nuw i32 %val, 6 @@ -64,9 +64,9 @@ define i32 @shifty_biggerLshr(i32 %val) { ; CHECK-LABEL: 'shifty_biggerLshr' ; CHECK-NEXT: Classifying expressions for: @shifty_biggerLshr ; CHECK-NEXT: %tmp1 = shl i32 %val, 4 -; CHECK-NEXT: --> (16 * %val) U: [0,-15) S: [-2147483648,2147483633) +; CHECK-NEXT: --> (16 * %val) U: [0,-15) S: [-2147483648,2147483633) ; CHECK-NEXT: %tmp2 = lshr i32 %tmp1, 6 -; CHECK-NEXT: --> ((16 * %val) /u 64) U: [0,67108864) S: [0,67108864) +; CHECK-NEXT: --> ((16 * %val) /u 64) U: [0,67108864) S: [0,67108864) ; CHECK-NEXT: Determining loop execution counts for: @shifty_biggerLshr ; %tmp1 = shl i32 %val, 4 @@ -78,9 +78,9 @@ define i32 @shifty_biggerLshr_shlnuw(i32 %val) { ; CHECK-LABEL: 'shifty_biggerLshr_shlnuw' ; CHECK-NEXT: Classifying expressions for: @shifty_biggerLshr_shlnuw ; CHECK-NEXT: %tmp1 = shl nuw i32 %val, 4 -; CHECK-NEXT: --> (16 * %val) U: [0,-15) S: [-2147483648,2147483633) +; CHECK-NEXT: --> (16 * %val) U: [0,-15) S: [-2147483648,2147483633) ; CHECK-NEXT: %tmp2 = lshr i32 %tmp1, 6 -; CHECK-NEXT: --> ((16 * %val) /u 64) U: [0,67108864) S: [0,67108864) +; CHECK-NEXT: --> ((16 * %val) /u 64) U: [0,67108864) S: [0,67108864) ; CHECK-NEXT: Determining loop execution counts for: @shifty_biggerLshr_shlnuw ; %tmp1 = shl nuw i32 %val, 4 @@ -94,9 +94,9 @@ define i32 @masky_biggerShl(i32 %val) { ; CHECK-LABEL: 'masky_biggerShl' ; CHECK-NEXT: Classifying expressions for: @masky_biggerShl ; CHECK-NEXT: %tmp1 = shl i32 %val, 2 -; CHECK-NEXT: --> (4 * %val) U: [0,-3) S: [-2147483648,2147483645) +; CHECK-NEXT: --> (4 * %val) U: [0,-3) S: [-2147483648,2147483645) ; CHECK-NEXT: %tmp2 = and i32 %tmp1, 268435452 -; CHECK-NEXT: --> (4 * (zext i26 (trunc i32 %val to i26) to i32)) U: [0,268435453) S: [0,268435453) +; CHECK-NEXT: --> (4 * (zext i26 (trunc i32 %val to i26) to i32)) U: [0,268435453) S: [0,268435453) ; CHECK-NEXT: Determining loop execution counts for: @masky_biggerShl ; %tmp1 = shl i32 %val, 2 @@ -108,7 +108,7 @@ define i32 @masky_biggerShl_shlnuw(i32 %val) { ; CHECK-LABEL: 'masky_biggerShl_shlnuw' ; CHECK-NEXT: Classifying expressions for: @masky_biggerShl_shlnuw ; CHECK-NEXT: %tmp1 = shl nuw i32 %val, 2 -; CHECK-NEXT: --> (4 * %val) U: [0,-3) S: [-2147483648,2147483645) +; CHECK-NEXT: --> (4 * %val) U: [0,-3) S: [-2147483648,2147483645) ; CHECK-NEXT: Determining loop execution counts for: @masky_biggerShl_shlnuw ; %tmp1 = shl nuw i32 %val, 2 @@ -119,9 +119,9 @@ define i32 @masky_biggerLshr(i32 %val) { ; CHECK-LABEL: 'masky_biggerLshr' ; CHECK-NEXT: Classifying expressions for: @masky_biggerLshr ; CHECK-NEXT: %tmp1 = lshr i32 %val, 2 -; CHECK-NEXT: --> (%val /u 4) U: [0,1073741824) S: [0,1073741824) +; CHECK-NEXT: --> (%val /u 4) U: [0,1073741824) S: [0,1073741824) ; CHECK-NEXT: %tmp2 = and i32 %tmp1, 67108863 -; CHECK-NEXT: --> (zext i26 (trunc i32 (%val /u 4) to i26) to i32) U: [0,67108864) S: [0,67108864) +; CHECK-NEXT: --> (zext i26 (trunc i32 (%val /u 4) to i26) to i32) U: [0,67108864) S: [0,67108864) ; CHECK-NEXT: Determining loop execution counts for: @masky_biggerLshr ; %tmp1 = lshr i32 %val, 2 @@ -133,7 +133,7 @@ define i32 @masky_biggerLshr_shlnuw(i32 %val) { ; CHECK-LABEL: 'masky_biggerLshr_shlnuw' ; CHECK-NEXT: Classifying expressions for: @masky_biggerLshr_shlnuw ; CHECK-NEXT: %tmp1 = lshr i32 %val, 2 -; CHECK-NEXT: --> (%val /u 4) U: [0,1073741824) S: [0,1073741824) +; CHECK-NEXT: --> (%val /u 4) U: [0,1073741824) S: [0,1073741824) ; CHECK-NEXT: Determining loop execution counts for: @masky_biggerLshr_shlnuw ; %tmp1 = lshr i32 %val, 2 diff --git a/llvm/test/Analysis/ScalarEvolution/smax-br-phi-idioms.ll b/llvm/test/Analysis/ScalarEvolution/smax-br-phi-idioms.ll index e307bd589a93d6..9ec124ed333c72 100644 --- a/llvm/test/Analysis/ScalarEvolution/smax-br-phi-idioms.ll +++ b/llvm/test/Analysis/ScalarEvolution/smax-br-phi-idioms.ll @@ -163,7 +163,7 @@ define i32 @f5(ptr %val) { ; CHECK-NEXT: symbolic max exit count for for.condt: false ; CHECK-NEXT: Loop %for.end: Predicated backedge-taken count is false ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.end: Trip multiple is 1 +; CHECK-NEXT: Loop %for.end: Trip multiple is 1 ; entry: br label %for.end diff --git a/llvm/test/Analysis/ScalarEvolution/smin-smax-folds.ll b/llvm/test/Analysis/ScalarEvolution/smin-smax-folds.ll index 57395a6a6cc2c3..5fc871433dd612 100644 --- a/llvm/test/Analysis/ScalarEvolution/smin-smax-folds.ll +++ b/llvm/test/Analysis/ScalarEvolution/smin-smax-folds.ll @@ -38,7 +38,7 @@ define void @smin_simplify_with_guard(i32 %n) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is %n ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is %n ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; entry: %cmp10 = icmp sgt i32 %n, -1 @@ -75,7 +75,7 @@ define void @smin_to_smax(i32 %n) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is ((-1 * (0 smin %n)) + %n) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is ((-1 * (0 smin %n)) + %n) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; entry: br label %for.body.lr.ph @@ -111,7 +111,7 @@ define void @smax_simplify_with_guard(i32 %start, i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-1 * %start) + %n) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-1 * %start) + %n) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %guard = icmp sge i32 %n, %start diff --git a/llvm/test/Analysis/ScalarEvolution/solve-quadratic-i1.ll b/llvm/test/Analysis/ScalarEvolution/solve-quadratic-i1.ll index a0cdb00c9b3aa6..89f15fa8737622 100644 --- a/llvm/test/Analysis/ScalarEvolution/solve-quadratic-i1.ll +++ b/llvm/test/Analysis/ScalarEvolution/solve-quadratic-i1.ll @@ -22,7 +22,7 @@ define void @f0() { ; CHECK-NEXT: Loop %b1: symbolic max backedge-taken count is 1 ; CHECK-NEXT: Loop %b1: Predicated backedge-taken count is 1 ; CHECK-NEXT: Predicates: -; CHECK: Loop %b1: Trip multiple is 2 +; CHECK-NEXT: Loop %b1: Trip multiple is 2 ; b0: br label %b1 @@ -73,7 +73,7 @@ define void @f1() #0 { ; CHECK-NEXT: Loop %b1: symbolic max backedge-taken count is 2 ; CHECK-NEXT: Loop %b1: Predicated backedge-taken count is 2 ; CHECK-NEXT: Predicates: -; CHECK: Loop %b1: Trip multiple is 3 +; CHECK-NEXT: Loop %b1: Trip multiple is 3 ; b0: store i16 0, ptr @g0, align 2 diff --git a/llvm/test/Analysis/ScalarEvolution/solve-quadratic-overflow.ll b/llvm/test/Analysis/ScalarEvolution/solve-quadratic-overflow.ll index 2f831827b549f6..e04d019b819c2f 100644 --- a/llvm/test/Analysis/ScalarEvolution/solve-quadratic-overflow.ll +++ b/llvm/test/Analysis/ScalarEvolution/solve-quadratic-overflow.ll @@ -28,7 +28,7 @@ define signext i32 @f0() { ; CHECK-NEXT: Loop %b1: symbolic max backedge-taken count is 255 ; CHECK-NEXT: Loop %b1: Predicated backedge-taken count is 255 ; CHECK-NEXT: Predicates: -; CHECK: Loop %b1: Trip multiple is 256 +; CHECK-NEXT: Loop %b1: Trip multiple is 256 ; b0: br label %b1 diff --git a/llvm/test/Analysis/ScalarEvolution/srem.ll b/llvm/test/Analysis/ScalarEvolution/srem.ll index c331f81301ad98..3a7f7e736607e5 100644 --- a/llvm/test/Analysis/ScalarEvolution/srem.ll +++ b/llvm/test/Analysis/ScalarEvolution/srem.ll @@ -35,7 +35,7 @@ define dso_local void @_Z4loopi(i32 %width) local_unnamed_addr #0 { ; CHECK-NEXT: Loop %for.cond: symbolic max backedge-taken count is %width ; CHECK-NEXT: Loop %for.cond: Predicated backedge-taken count is %width ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.cond: Trip multiple is 1 +; CHECK-NEXT: Loop %for.cond: Trip multiple is 1 ; entry: %storage = alloca [2 x i32], align 4 diff --git a/llvm/test/Analysis/ScalarEvolution/symbolic_max_exit_count.ll b/llvm/test/Analysis/ScalarEvolution/symbolic_max_exit_count.ll index 9cbb6263e3935c..d0be0082e71386 100644 --- a/llvm/test/Analysis/ScalarEvolution/symbolic_max_exit_count.ll +++ b/llvm/test/Analysis/ScalarEvolution/symbolic_max_exit_count.ll @@ -413,7 +413,7 @@ define i32 @test_two_phis_simple(i32 %start_1, i32 %start_2, i32 %len) { ; CHECK-NEXT: symbolic max exit count for backedge: %start_2 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%start_1 umin_seq %start_2) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop diff --git a/llvm/test/Analysis/ScalarEvolution/trip-count-andor-selectform.ll b/llvm/test/Analysis/ScalarEvolution/trip-count-andor-selectform.ll index 6cf57f5afbbbd8..42fca4adbca5e6 100644 --- a/llvm/test/Analysis/ScalarEvolution/trip-count-andor-selectform.ll +++ b/llvm/test/Analysis/ScalarEvolution/trip-count-andor-selectform.ll @@ -12,7 +12,7 @@ define void @unsimplified_and1(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %n ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %n ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -36,7 +36,7 @@ define void @unsimplified_and2(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %n ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %n ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -60,7 +60,7 @@ define void @unsimplified_and3(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is false ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is false ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -84,7 +84,7 @@ define void @unsimplified_and4(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is false ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is false ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -152,7 +152,7 @@ define void @unsimplified_or3(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %n ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %n ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -176,7 +176,7 @@ define void @unsimplified_or4(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %n ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %n ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -200,7 +200,7 @@ define void @reversed_and1(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %n ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %n ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -224,7 +224,7 @@ define void @reversed_and2(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %n ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %n ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -292,7 +292,7 @@ define void @reversed_or1(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is false ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is false ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -316,7 +316,7 @@ define void @reversed_or2(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is false ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is false ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -340,7 +340,7 @@ define void @reversed_or3(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %n ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %n ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -364,7 +364,7 @@ define void @reversed_or4(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %n ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %n ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop diff --git a/llvm/test/Analysis/ScalarEvolution/trip-count-andor.ll b/llvm/test/Analysis/ScalarEvolution/trip-count-andor.ll index bb91e842446bf9..c689cb4e3b867c 100644 --- a/llvm/test/Analysis/ScalarEvolution/trip-count-andor.ll +++ b/llvm/test/Analysis/ScalarEvolution/trip-count-andor.ll @@ -12,7 +12,7 @@ define void @unsimplified_and1(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %n ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %n ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -36,7 +36,7 @@ define void @unsimplified_and2(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %n ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %n ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -60,7 +60,7 @@ define void @unsimplified_and3(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is false ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is false ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -84,7 +84,7 @@ define void @unsimplified_and4(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is false ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is false ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -152,7 +152,7 @@ define void @unsimplified_or3(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %n ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %n ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -176,7 +176,7 @@ define void @unsimplified_or4(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %n ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %n ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -200,7 +200,7 @@ define void @reversed_and1(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %n ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %n ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -224,7 +224,7 @@ define void @reversed_and2(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %n ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %n ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -292,7 +292,7 @@ define void @reversed_or1(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is false ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is false ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -316,7 +316,7 @@ define void @reversed_or2(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is false ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is false ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -340,7 +340,7 @@ define void @reversed_or3(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %n ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %n ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop @@ -364,7 +364,7 @@ define void @reversed_or4(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %n ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %n ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop diff --git a/llvm/test/Analysis/ScalarEvolution/trip-count-implied-addrec.ll b/llvm/test/Analysis/ScalarEvolution/trip-count-implied-addrec.ll index 98423bf246e888..e04563207d78bd 100644 --- a/llvm/test/Analysis/ScalarEvolution/trip-count-implied-addrec.ll +++ b/llvm/test/Analysis/ScalarEvolution/trip-count-implied-addrec.ll @@ -17,7 +17,7 @@ define void @nw_implies_nuw(i16 %n) mustprogress { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is %n ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is %n ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; entry: br label %for.body @@ -63,7 +63,7 @@ define void @nw_implies_nsw(i16 %n) mustprogress { ; CHECK-NEXT: Loop %for.body: Unpredictable symbolic max backedge-taken count. ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (128 + (-128 smax %n)) ; CHECK-NEXT: Predicates: -; CHECK-NEXT: {-128,+,1}<%for.body> Added Flags: +; CHECK-NEXT: {-128,+,1}<%for.body> Added Flags: ; entry: br label %for.body @@ -110,7 +110,7 @@ define void @actually_infinite() { ; CHECK-NEXT: Loop %for.body: Unpredictable symbolic max backedge-taken count. ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is 257 ; CHECK-NEXT: Predicates: -; CHECK-NEXT: {0,+,1}<%for.body> Added Flags: +; CHECK-NEXT: {0,+,1}<%for.body> Added Flags: ; entry: br label %for.body @@ -135,7 +135,7 @@ define void @rhs_mustexit_1(i16 %n.raw) mustprogress { ; CHECK-NEXT: Loop %for.body: Unpredictable symbolic max backedge-taken count. ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + (1 umax (-1 + (zext i8 (trunc i16 %n.raw to i8) to i16)))) ; CHECK-NEXT: Predicates: -; CHECK-NEXT: {1,+,1}<%for.body> Added Flags: +; CHECK-NEXT: {1,+,1}<%for.body> Added Flags: ; entry: %n.and = and i16 %n.raw, 255 @@ -239,7 +239,7 @@ define void @neg_rhs_wrong_range(i16 %n.raw) mustprogress { ; CHECK-NEXT: Loop %for.body: Unpredictable symbolic max backedge-taken count. ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is ((-1 + (2 umax (-1 + (zext i8 (trunc i16 %n.raw to i8) to i16)))) /u 2) ; CHECK-NEXT: Predicates: -; CHECK-NEXT: {2,+,2}<%for.body> Added Flags: +; CHECK-NEXT: {2,+,2}<%for.body> Added Flags: ; entry: %n.and = and i16 %n.raw, 255 @@ -266,7 +266,7 @@ define void @neg_rhs_maybe_infinite(i16 %n.raw) { ; CHECK-NEXT: Loop %for.body: Unpredictable symbolic max backedge-taken count. ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + (1 umax (-1 + (zext i8 (trunc i16 %n.raw to i8) to i16)))) ; CHECK-NEXT: Predicates: -; CHECK-NEXT: {1,+,1}<%for.body> Added Flags: +; CHECK-NEXT: {1,+,1}<%for.body> Added Flags: ; entry: %n.and = and i16 %n.raw, 255 @@ -295,7 +295,7 @@ define void @rhs_narrow_range(i16 %n.raw) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + (1 umax (2 * (zext i7 (trunc i16 (%n.raw /u 2) to i7) to i16)))) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + (1 umax (2 * (zext i7 (trunc i16 (%n.raw /u 2) to i7) to i16)))) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; entry: %n = and i16 %n.raw, 254 @@ -345,7 +345,7 @@ define void @ult_constant_rhs(i16 %n.raw, i8 %start) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (255 + (-1 * (zext i8 (1 + %start) to i16))) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (255 + (-1 * (zext i8 (1 + %start) to i16))) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; entry: br label %for.body @@ -370,7 +370,7 @@ define void @ult_constant_rhs_stride2(i16 %n.raw, i8 %start) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is ((1 + (-1 * (zext i8 (2 + %start) to i16)) + (254 umax (zext i8 (2 + %start) to i16))) /u 2) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is ((1 + (-1 * (zext i8 (2 + %start) to i16)) + (254 umax (zext i8 (2 + %start) to i16))) /u 2) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; entry: br label %for.body @@ -395,7 +395,7 @@ define void @ult_constant_rhs_stride2_neg(i16 %n.raw, i8 %start) { ; CHECK-NEXT: Loop %for.body: Unpredictable symbolic max backedge-taken count. ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is ((256 + (-1 * (zext i8 (2 + %start) to i16))) /u 2) ; CHECK-NEXT: Predicates: -; CHECK-NEXT: {(2 + %start),+,2}<%for.body> Added Flags: +; CHECK-NEXT: {(2 + %start),+,2}<%for.body> Added Flags: ; entry: br label %for.body @@ -420,7 +420,7 @@ define void @ult_restricted_rhs(i16 %n.raw) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + (1 umax (zext i8 (trunc i16 %n.raw to i8) to i16))) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + (1 umax (zext i8 (trunc i16 %n.raw to i8) to i16))) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; entry: %n = and i16 %n.raw, 255 @@ -445,7 +445,7 @@ define void @ult_guarded_rhs(i16 %n) {; ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + (1 umax %n)) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + (1 umax %n)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; entry: %in_range = icmp ult i16 %n, 256 diff --git a/llvm/test/Analysis/ScalarEvolution/trip-count-minmax.ll b/llvm/test/Analysis/ScalarEvolution/trip-count-minmax.ll index 431e604358cbc2..7d4876baa9e5d9 100644 --- a/llvm/test/Analysis/ScalarEvolution/trip-count-minmax.ll +++ b/llvm/test/Analysis/ScalarEvolution/trip-count-minmax.ll @@ -19,7 +19,7 @@ define void @nomulitply(i32 noundef %a, i32 noundef %b) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + (%a umin %b)) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + (%a umin %b)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; ; No information about a or b. Trip multiple is 1. ; void nomulitple(unsigned a, unsigned b) { @@ -65,7 +65,7 @@ define void @umin(i32 noundef %a, i32 noundef %b) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + ((2 * %a) umin (4 * %b))) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + ((2 * %a) umin (4 * %b))) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; ; void umin(unsigned a, unsigned b) { ; a *= 2; @@ -115,7 +115,7 @@ define void @umax(i32 noundef %a, i32 noundef %b) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + ((2 * %a) umax (4 * %b))) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + ((2 * %a) umax (4 * %b))) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 2 +; CHECK-NEXT: Loop %for.body: Trip multiple is 2 ; ; void umax(unsigned a, unsigned b) { @@ -165,7 +165,7 @@ define void @smin(i32 noundef %a, i32 noundef %b) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + ((2 * %a) smin (4 * %b))) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + ((2 * %a) smin (4 * %b))) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; ; void smin(signed a, signed b) { ; a *= 2; @@ -214,7 +214,7 @@ define void @smax(i32 noundef %a, i32 noundef %b) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + ((2 * %a) smax (4 * %b))) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + ((2 * %a) smax (4 * %b))) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 2 +; CHECK-NEXT: Loop %for.body: Trip multiple is 2 ; ; void smax(signed a, signed b) { ; a *= 2; @@ -263,7 +263,7 @@ define void @umin_seq2(i32 %n, i32 %m) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-1 + (1 umax (2 * %n))) umin_seq (-1 + (1 umax (16 * %m)))) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-1 + (1 umax (2 * %n))) umin_seq (-1 + (1 umax (16 * %m)))) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; ; Can't find that trip multiple is 2 for this case of umin_seq entry: @@ -301,7 +301,7 @@ define void @umin-3and6(i32 noundef %a, i32 noundef %b) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + ((3 * %a) umin (6 * %b))) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + ((3 * %a) umin (6 * %b))) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; ; Trip multiple is 1 because we use GetMinTrailingZeros() to compute trip multiples. ; SCEV cannot compute that the trip multiple is 3. diff --git a/llvm/test/Analysis/ScalarEvolution/trip-count.ll b/llvm/test/Analysis/ScalarEvolution/trip-count.ll index 0e8898f55a7c25..5973d52d05ea6f 100644 --- a/llvm/test/Analysis/ScalarEvolution/trip-count.ll +++ b/llvm/test/Analysis/ScalarEvolution/trip-count.ll @@ -14,7 +14,7 @@ define void @PR1101(i32 %N) { ; CHECK-NEXT: Loop %bb3: symbolic max backedge-taken count is 10000 ; CHECK-NEXT: Loop %bb3: Predicated backedge-taken count is 10000 ; CHECK-NEXT: Predicates: -; CHECK: Loop %bb3: Trip multiple is 10001 +; CHECK-NEXT: Loop %bb3: Trip multiple is 10001 ; entry: br label %bb3 @@ -45,7 +45,7 @@ define i32 @PR22795() { ; CHECK-NEXT: Loop %preheader: symbolic max backedge-taken count is 7 ; CHECK-NEXT: Loop %preheader: Predicated backedge-taken count is 7 ; CHECK-NEXT: Predicates: -; CHECK: Loop %preheader: Trip multiple is 8 +; CHECK-NEXT: Loop %preheader: Trip multiple is 8 ; entry: %bins = alloca [16 x i64], align 16 @@ -108,7 +108,7 @@ define void @pr28012(i32 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is -1431655751 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is -1431655751 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 2863311546 +; CHECK-NEXT: Loop %loop: Trip multiple is 2863311546 ; entry: br label %loop diff --git a/llvm/test/Analysis/ScalarEvolution/trip-count10.ll b/llvm/test/Analysis/ScalarEvolution/trip-count10.ll index 9131094f9cb598..2b2439c0ac4669 100644 --- a/llvm/test/Analysis/ScalarEvolution/trip-count10.ll +++ b/llvm/test/Analysis/ScalarEvolution/trip-count10.ll @@ -32,7 +32,7 @@ define void @b(i64 %n) nounwind { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is false ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is false ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %t0 = icmp sgt i64 %n, 0 @@ -55,7 +55,7 @@ define void @c(i64 %n) nounwind { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is false ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is false ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %t0 = icmp sgt i64 %n, 0 @@ -136,7 +136,7 @@ define void @constant_phi_operands() nounwind { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 1 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 1 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 2 +; CHECK-NEXT: Loop %loop: Trip multiple is 2 ; entry: br label %loop diff --git a/llvm/test/Analysis/ScalarEvolution/trip-count14.ll b/llvm/test/Analysis/ScalarEvolution/trip-count14.ll index 1e835303146687..7c551afc79e4dd 100644 --- a/llvm/test/Analysis/ScalarEvolution/trip-count14.ll +++ b/llvm/test/Analysis/ScalarEvolution/trip-count14.ll @@ -9,7 +9,7 @@ define void @s32_max1(i32 %n, ptr %p) { ; CHECK-NEXT: Loop %do.body: symbolic max backedge-taken count is ((-1 * %n) + ((1 + %n) smax %n)), actual taken count either this or zero. ; CHECK-NEXT: Loop %do.body: Predicated backedge-taken count is ((-1 * %n) + ((1 + %n) smax %n)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %do.body: Trip multiple is 1 +; CHECK-NEXT: Loop %do.body: Trip multiple is 1 ; entry: %add = add i32 %n, 1 @@ -35,7 +35,7 @@ define void @s32_max2(i32 %n, ptr %p) { ; CHECK-NEXT: Loop %do.body: symbolic max backedge-taken count is ((-1 * %n) + ((2 + %n) smax %n)), actual taken count either this or zero. ; CHECK-NEXT: Loop %do.body: Predicated backedge-taken count is ((-1 * %n) + ((2 + %n) smax %n)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %do.body: Trip multiple is 1 +; CHECK-NEXT: Loop %do.body: Trip multiple is 1 ; entry: %add = add i32 %n, 2 @@ -61,7 +61,7 @@ define void @s32_maxx(i32 %n, i32 %x, ptr %p) { ; CHECK-NEXT: Loop %do.body: symbolic max backedge-taken count is ((-1 * %n) + ((%n + %x) smax %n)) ; CHECK-NEXT: Loop %do.body: Predicated backedge-taken count is ((-1 * %n) + ((%n + %x) smax %n)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %do.body: Trip multiple is 1 +; CHECK-NEXT: Loop %do.body: Trip multiple is 1 ; entry: %add = add i32 %x, %n @@ -91,7 +91,7 @@ define void @s32_max2_unpredictable_exit(i32 %n, i32 %x, ptr %p) { ; CHECK-NEXT: symbolic max exit count for if.end: ((-1 * %n) + ((2 + %n) smax %n)) ; CHECK-NEXT: Loop %do.body: Predicated backedge-taken count is (((-1 * %n) + ((2 + %n) smax %n)) umin ((-1 * %n) + %x)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %do.body: Trip multiple is 1 +; CHECK-NEXT: Loop %do.body: Trip multiple is 1 ; entry: %add = add i32 %n, 2 @@ -121,7 +121,7 @@ define void @u32_max1(i32 %n, ptr %p) { ; CHECK-NEXT: Loop %do.body: symbolic max backedge-taken count is ((-1 * %n) + ((1 + %n) umax %n)), actual taken count either this or zero. ; CHECK-NEXT: Loop %do.body: Predicated backedge-taken count is ((-1 * %n) + ((1 + %n) umax %n)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %do.body: Trip multiple is 1 +; CHECK-NEXT: Loop %do.body: Trip multiple is 1 ; entry: %add = add i32 %n, 1 @@ -147,7 +147,7 @@ define void @u32_max2(i32 %n, ptr %p) { ; CHECK-NEXT: Loop %do.body: symbolic max backedge-taken count is ((-1 * %n) + ((2 + %n) umax %n)), actual taken count either this or zero. ; CHECK-NEXT: Loop %do.body: Predicated backedge-taken count is ((-1 * %n) + ((2 + %n) umax %n)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %do.body: Trip multiple is 1 +; CHECK-NEXT: Loop %do.body: Trip multiple is 1 ; entry: %add = add i32 %n, 2 @@ -173,7 +173,7 @@ define void @u32_maxx(i32 %n, i32 %x, ptr %p) { ; CHECK-NEXT: Loop %do.body: symbolic max backedge-taken count is ((-1 * %n) + ((%n + %x) umax %n)) ; CHECK-NEXT: Loop %do.body: Predicated backedge-taken count is ((-1 * %n) + ((%n + %x) umax %n)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %do.body: Trip multiple is 1 +; CHECK-NEXT: Loop %do.body: Trip multiple is 1 ; entry: %add = add i32 %x, %n @@ -203,7 +203,7 @@ define void @u32_max2_unpredictable_exit(i32 %n, i32 %x, ptr %p) { ; CHECK-NEXT: symbolic max exit count for if.end: ((-1 * %n) + ((2 + %n) umax %n)) ; CHECK-NEXT: Loop %do.body: Predicated backedge-taken count is (((-1 * %n) + ((2 + %n) umax %n)) umin ((-1 * %n) + %x)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %do.body: Trip multiple is 1 +; CHECK-NEXT: Loop %do.body: Trip multiple is 1 ; entry: %add = add i32 %n, 2 diff --git a/llvm/test/Analysis/ScalarEvolution/trip-count15.ll b/llvm/test/Analysis/ScalarEvolution/trip-count15.ll index e043357aa09c30..2a995c635ca7a3 100644 --- a/llvm/test/Analysis/ScalarEvolution/trip-count15.ll +++ b/llvm/test/Analysis/ScalarEvolution/trip-count15.ll @@ -16,7 +16,7 @@ define void @umin_unsigned_check(i64 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (1 + (4096 umin %n)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (1 + (4096 umin %n)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %min.cmp = icmp ult i64 4096, %n @@ -47,7 +47,7 @@ define void @umin_signed_check(i64 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (1 + (4096 umin %n)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (1 + (4096 umin %n)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %min.cmp = icmp ult i64 4096, %n @@ -78,7 +78,7 @@ define void @smin_signed_check(i64 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (0 smax (1 + (4096 smin %n))) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (0 smax (1 + (4096 smin %n))) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %min.cmp = icmp slt i64 4096, %n diff --git a/llvm/test/Analysis/ScalarEvolution/trip-count2.ll b/llvm/test/Analysis/ScalarEvolution/trip-count2.ll index a71c9020d3fbea..adc15a118368d2 100644 --- a/llvm/test/Analysis/ScalarEvolution/trip-count2.ll +++ b/llvm/test/Analysis/ScalarEvolution/trip-count2.ll @@ -11,7 +11,7 @@ define void @PR1101(i32 %N) { ; CHECK-NEXT: Loop %bb3: symbolic max backedge-taken count is 4 ; CHECK-NEXT: Loop %bb3: Predicated backedge-taken count is 4 ; CHECK-NEXT: Predicates: -; CHECK: Loop %bb3: Trip multiple is 5 +; CHECK-NEXT: Loop %bb3: Trip multiple is 5 ; entry: br label %bb3 diff --git a/llvm/test/Analysis/ScalarEvolution/trip-count3.ll b/llvm/test/Analysis/ScalarEvolution/trip-count3.ll index e48bd5b9e62eb6..232878ed3083d0 100644 --- a/llvm/test/Analysis/ScalarEvolution/trip-count3.ll +++ b/llvm/test/Analysis/ScalarEvolution/trip-count3.ll @@ -44,7 +44,7 @@ define void @sha_stream_bb3_2E_i(ptr %sha_info, ptr %data1, i32, ptr %buffer_add ; CHECK-NEXT: Loop %bb3.i: symbolic max backedge-taken count is ((63 + (-1 * (63 smin %0)) + %0) /u 64) ; CHECK-NEXT: Loop %bb3.i: Predicated backedge-taken count is ((63 + (-1 * (63 smin %0)) + %0) /u 64) ; CHECK-NEXT: Predicates: -; CHECK: Loop %bb3.i: Trip multiple is 1 +; CHECK-NEXT: Loop %bb3.i: Trip multiple is 1 ; newFuncRoot: br label %bb3.i diff --git a/llvm/test/Analysis/ScalarEvolution/trip-count4.ll b/llvm/test/Analysis/ScalarEvolution/trip-count4.ll index 29829eba45ef50..c8e83ffd757ac2 100644 --- a/llvm/test/Analysis/ScalarEvolution/trip-count4.ll +++ b/llvm/test/Analysis/ScalarEvolution/trip-count4.ll @@ -11,7 +11,7 @@ define void @another_count_down_signed(ptr %d, i64 %n) nounwind { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-11 + %n) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-11 + %n) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: br label %loop diff --git a/llvm/test/Analysis/ScalarEvolution/trip-count8.ll b/llvm/test/Analysis/ScalarEvolution/trip-count8.ll index cc4ee5b5a3a33d..a0bb7a8e063259 100644 --- a/llvm/test/Analysis/ScalarEvolution/trip-count8.ll +++ b/llvm/test/Analysis/ScalarEvolution/trip-count8.ll @@ -12,7 +12,7 @@ define i32 @foo(i32 %ecx) nounwind { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + %ecx) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + %ecx) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; entry: %cmp2 = icmp eq i32 %ecx, 0 ; [#uses=1] diff --git a/llvm/test/Analysis/ScalarEvolution/trip-count9.ll b/llvm/test/Analysis/ScalarEvolution/trip-count9.ll index 55d299c82dd441..5301ac5f9eb3b8 100644 --- a/llvm/test/Analysis/ScalarEvolution/trip-count9.ll +++ b/llvm/test/Analysis/ScalarEvolution/trip-count9.ll @@ -17,7 +17,7 @@ define void @foo(i4 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %n) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %n) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %s = icmp sgt i4 %n, 0 @@ -59,7 +59,7 @@ define void @start1(i4 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-2 + (2 smax %n)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-2 + (2 smax %n)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %s = icmp sgt i4 %n, 0 @@ -101,7 +101,7 @@ define void @startx(i4 %n, i4 %x) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + (-1 * %x) + ((1 + %x) smax %n)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + (-1 * %x) + ((1 + %x) smax %n)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %s = icmp sgt i4 %n, 0 @@ -143,7 +143,7 @@ define void @nsw(i4 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %n) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %n) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %s = icmp sgt i4 %n, 0 @@ -173,7 +173,7 @@ define void @nsw_step2(i4 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-1 + %n) /u 2) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-1 + %n) /u 2) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %s = icmp sgt i4 %n, 0 @@ -195,7 +195,7 @@ define void @nsw_start1(i4 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-2 + (2 smax %n)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-2 + (2 smax %n)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %s = icmp sgt i4 %n, 0 @@ -217,7 +217,7 @@ define void @nsw_start1_step2(i4 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-2 + (3 smax %n)) /u 2) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-2 + (3 smax %n)) /u 2) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %s = icmp sgt i4 %n, 0 @@ -239,7 +239,7 @@ define void @nsw_startx(i4 %n, i4 %x) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + (-1 * %x) + ((1 + %x) smax %n)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + (-1 * %x) + ((1 + %x) smax %n)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %s = icmp sgt i4 %n, 0 @@ -261,7 +261,7 @@ define void @nsw_startx_step2(i4 %n, i4 %x) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-1 + (-1 * %x) + ((2 + %x) smax %n)) /u 2) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-1 + (-1 * %x) + ((2 + %x) smax %n)) /u 2) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %s = icmp sgt i4 %n, 0 @@ -283,7 +283,7 @@ define void @even(i4 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + (2 * %n)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + (2 * %n)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 2 +; CHECK-NEXT: Loop %loop: Trip multiple is 2 ; entry: %m = shl i4 %n, 1 @@ -306,7 +306,7 @@ define void @even_step2(i4 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-1 + (2 * %n)) /u 2) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-1 + (2 * %n)) /u 2) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %m = shl i4 %n, 1 @@ -329,7 +329,7 @@ define void @even_start1(i4 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-2 + (2 * %n)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-2 + (2 * %n)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %m = shl i4 %n, 1 @@ -352,7 +352,7 @@ define void @even_start1_step2(i4 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-2 + (2 * %n)) /u 2) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-2 + (2 * %n)) /u 2) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %m = shl i4 %n, 1 @@ -375,7 +375,7 @@ define void @even_startx(i4 %n, i4 %x) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + (-1 * %x) + ((1 + %x) smax (2 * %n))) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + (-1 * %x) + ((1 + %x) smax (2 * %n))) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %m = shl i4 %n, 1 @@ -398,7 +398,7 @@ define void @even_startx_step2(i4 %n, i4 %x) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-1 + (-1 * %x) + ((2 + %x) smax (2 * %n))) /u 2) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-1 + (-1 * %x) + ((2 + %x) smax (2 * %n))) /u 2) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %m = shl i4 %n, 1 @@ -421,7 +421,7 @@ define void @even_nsw(i4 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + (2 * %n)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + (2 * %n)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 2 +; CHECK-NEXT: Loop %loop: Trip multiple is 2 ; entry: %m = shl i4 %n, 1 @@ -444,7 +444,7 @@ define void @even_nsw_step2(i4 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-1 + (2 * %n)) /u 2) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-1 + (2 * %n)) /u 2) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %m = shl i4 %n, 1 @@ -467,7 +467,7 @@ define void @even_nsw_start1(i4 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-2 + (2 * %n)) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-2 + (2 * %n)) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %m = shl i4 %n, 1 @@ -490,7 +490,7 @@ define void @even_nsw_start1_step2(i4 %n) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-2 + (2 * %n)) /u 2) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-2 + (2 * %n)) /u 2) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %m = shl i4 %n, 1 @@ -513,7 +513,7 @@ define void @even_nsw_startx(i4 %n, i4 %x) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + (-1 * %x) + ((1 + %x) smax (2 * %n))) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + (-1 * %x) + ((1 + %x) smax (2 * %n))) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %m = shl i4 %n, 1 @@ -536,7 +536,7 @@ define void @even_nsw_startx_step2(i4 %n, i4 %x) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-1 + (-1 * %x) + ((2 + %x) smax (2 * %n))) /u 2) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-1 + (-1 * %x) + ((2 + %x) smax (2 * %n))) /u 2) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %m = shl i4 %n, 1 diff --git a/llvm/test/Analysis/ScalarEvolution/trip-multiple-guard-info.ll b/llvm/test/Analysis/ScalarEvolution/trip-multiple-guard-info.ll index da7bdbcf2d9262..a0a5158bdff160 100644 --- a/llvm/test/Analysis/ScalarEvolution/trip-multiple-guard-info.ll +++ b/llvm/test/Analysis/ScalarEvolution/trip-multiple-guard-info.ll @@ -18,7 +18,7 @@ define void @test_trip_multiple_4(i32 %num) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + %num) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + %num) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 4 +; CHECK-NEXT: Loop %for.body: Trip multiple is 4 ; entry: %u = urem i32 %num, 4 @@ -53,7 +53,7 @@ define void @test_trip_multiple_4_guard(i32 %num) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + %num) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + %num) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 4 +; CHECK-NEXT: Loop %for.body: Trip multiple is 4 ; entry: %u = urem i32 %num, 4 @@ -89,7 +89,7 @@ define void @test_trip_multiple_4_ugt_5(i32 %num) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + %num) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + %num) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 4 +; CHECK-NEXT: Loop %for.body: Trip multiple is 4 ; entry: %u = urem i32 %num, 4 @@ -125,7 +125,7 @@ define void @test_trip_multiple_4_ugt_5_order_swapped(i32 %num) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + %num) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + %num) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 4 +; CHECK-NEXT: Loop %for.body: Trip multiple is 4 ; entry: %u = urem i32 %num, 4 @@ -160,7 +160,7 @@ define void @test_trip_multiple_4_sgt_5(i32 %num) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + %num) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + %num) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 4 +; CHECK-NEXT: Loop %for.body: Trip multiple is 4 ; entry: %u = urem i32 %num, 4 @@ -196,7 +196,7 @@ define void @test_trip_multiple_4_sgt_5_order_swapped(i32 %num) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + %num) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + %num) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 4 +; CHECK-NEXT: Loop %for.body: Trip multiple is 4 ; entry: %u = urem i32 %num, 4 @@ -231,7 +231,7 @@ define void @test_trip_multiple_4_uge_5(i32 %num) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + %num) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + %num) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 4 +; CHECK-NEXT: Loop %for.body: Trip multiple is 4 ; entry: %u = urem i32 %num, 4 @@ -267,7 +267,7 @@ define void @test_trip_multiple_4_uge_5_order_swapped(i32 %num) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + %num) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + %num) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 4 +; CHECK-NEXT: Loop %for.body: Trip multiple is 4 ; entry: %u = urem i32 %num, 4 @@ -303,7 +303,7 @@ define void @test_trip_multiple_4_sge_5(i32 %num) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + %num) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + %num) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 4 +; CHECK-NEXT: Loop %for.body: Trip multiple is 4 ; entry: %u = urem i32 %num, 4 @@ -338,7 +338,7 @@ define void @test_trip_multiple_4_sge_5_order_swapped(i32 %num) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + %num) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + %num) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 4 +; CHECK-NEXT: Loop %for.body: Trip multiple is 4 ; entry: %u = urem i32 %num, 4 @@ -374,7 +374,7 @@ define void @test_trip_multiple_4_icmp_ops_swapped(i32 %num) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + %num) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + %num) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 4 +; CHECK-NEXT: Loop %for.body: Trip multiple is 4 ; entry: %u = urem i32 %num, 4 @@ -409,7 +409,7 @@ define void @test_trip_multiple_4_upper_lower_bounds(i32 %num) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + %num) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + %num) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 4 +; CHECK-NEXT: Loop %for.body: Trip multiple is 4 ; entry: %cmp.1 = icmp uge i32 %num, 5 @@ -446,7 +446,7 @@ define void @test_trip_multiple_4_upper_lower_bounds_swapped1(i32 %num) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + %num) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + %num) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 4 +; CHECK-NEXT: Loop %for.body: Trip multiple is 4 ; entry: %cmp.1 = icmp uge i32 %num, 5 @@ -483,7 +483,7 @@ define void @test_trip_multiple_4_upper_lower_bounds_swapped2(i32 %num) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + %num) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + %num) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 4 +; CHECK-NEXT: Loop %for.body: Trip multiple is 4 ; entry: %cmp.1 = icmp uge i32 %num, 5 @@ -520,7 +520,7 @@ define void @test_trip_multiple_5(i32 %num) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + %num) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + %num) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 5 +; CHECK-NEXT: Loop %for.body: Trip multiple is 5 ; entry: %u = urem i32 %num, 5 @@ -557,7 +557,7 @@ define void @test_trunc_operand_larger_than_urem_expr(i64 %N) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + %N) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + %N) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 1 +; CHECK-NEXT: Loop %for.body: Trip multiple is 1 ; entry: %conv = trunc i64 %N to i32 diff --git a/llvm/test/Analysis/ScalarEvolution/trip-multiple.ll b/llvm/test/Analysis/ScalarEvolution/trip-multiple.ll index 65d3c5938001fd..a292dcec77960e 100644 --- a/llvm/test/Analysis/ScalarEvolution/trip-multiple.ll +++ b/llvm/test/Analysis/ScalarEvolution/trip-multiple.ll @@ -29,7 +29,7 @@ define void @trip_multiple_3(i32 noundef %num) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + %num) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + %num) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 3 +; CHECK-NEXT: Loop %for.body: Trip multiple is 3 ; entry: %rem = urem i32 %num, 3 @@ -65,7 +65,7 @@ define void @trip_multiple_4(i32 noundef %num) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + %num) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + %num) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 4 +; CHECK-NEXT: Loop %for.body: Trip multiple is 4 ; entry: %rem = urem i32 %num, 4 @@ -102,7 +102,7 @@ define void @trip_multiple_5(i32 noundef %num) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + %num) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + %num) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 5 +; CHECK-NEXT: Loop %for.body: Trip multiple is 5 ; entry: %rem = urem i32 %num, 5 @@ -139,7 +139,7 @@ define void @trip_multiple_6(i32 noundef %num) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + %num) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + %num) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 6 +; CHECK-NEXT: Loop %for.body: Trip multiple is 6 ; entry: %rem = urem i32 %num, 6 @@ -176,7 +176,7 @@ define void @trip_multiple_7(i32 noundef %num) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + %num) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + %num) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 7 +; CHECK-NEXT: Loop %for.body: Trip multiple is 7 ; entry: %rem = urem i32 %num, 7 @@ -213,7 +213,7 @@ define void @trip_multiple_8(i32 noundef %num) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + %num) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + %num) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 8 +; CHECK-NEXT: Loop %for.body: Trip multiple is 8 ; entry: %rem = urem i32 %num, 8 @@ -249,7 +249,7 @@ define void @trip_multiple_9(i32 noundef %num) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + %num) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + %num) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 9 +; CHECK-NEXT: Loop %for.body: Trip multiple is 9 ; entry: %rem = urem i32 %num, 9 @@ -285,7 +285,7 @@ define void @trip_multiple_10(i32 noundef %num) { ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (-1 + %num) ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + %num) ; CHECK-NEXT: Predicates: -; CHECK: Loop %for.body: Trip multiple is 10 +; CHECK-NEXT: Loop %for.body: Trip multiple is 10 ; entry: %rem = urem i32 %num, 10 diff --git a/llvm/test/Analysis/ScalarEvolution/umin-umax-folds.ll b/llvm/test/Analysis/ScalarEvolution/umin-umax-folds.ll index 74c07c2933e3f1..94f4acc0c5d115 100644 --- a/llvm/test/Analysis/ScalarEvolution/umin-umax-folds.ll +++ b/llvm/test/Analysis/ScalarEvolution/umin-umax-folds.ll @@ -20,7 +20,7 @@ define void @umin_sext_x_zext_x(i32 %len) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (zext i32 %len to i64) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (zext i32 %len to i64) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %len.zext = zext i32 %len to i64 @@ -56,7 +56,7 @@ define void @ule_sext_x_zext_x(i32 %len) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (zext i32 %len to i64) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (zext i32 %len to i64) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %len.zext = zext i32 %len to i64 @@ -92,7 +92,7 @@ define void @uge_sext_x_zext_x(i32 %len) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (sext i32 %len to i64) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (sext i32 %len to i64) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %len.zext = zext i32 %len to i64 @@ -128,7 +128,7 @@ define void @ult_sext_x_zext_x(i32 %len) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (zext i32 %len to i64) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (zext i32 %len to i64) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %len.zext = zext i32 %len to i64 @@ -164,7 +164,7 @@ define void @ugt_sext_x_zext_x(i32 %len) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (sext i32 %len to i64) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (sext i32 %len to i64) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %len.zext = zext i32 %len to i64 @@ -200,7 +200,7 @@ define void @sle_sext_x_zext_x(i32 %len) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (zext i32 %len to i64) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (zext i32 %len to i64) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %len.zext = zext i32 %len to i64 @@ -236,7 +236,7 @@ define void @sge_sext_x_zext_x(i32 %len) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (zext i32 %len to i64) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (zext i32 %len to i64) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %len.zext = zext i32 %len to i64 @@ -272,7 +272,7 @@ define void @slt_sext_x_zext_x(i32 %len) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (sext i32 %len to i64) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (sext i32 %len to i64) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %len.zext = zext i32 %len to i64 @@ -308,7 +308,7 @@ define void @sgt_sext_x_zext_x(i32 %len) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (zext i32 %len to i64) ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (zext i32 %len to i64) ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 1 +; CHECK-NEXT: Loop %loop: Trip multiple is 1 ; entry: %len.zext = zext i32 %len to i64 diff --git a/llvm/test/Analysis/ScalarEvolution/unknown_phis.ll b/llvm/test/Analysis/ScalarEvolution/unknown_phis.ll index d0fab9b9447cb5..7bd7a5eb2cfcc3 100644 --- a/llvm/test/Analysis/ScalarEvolution/unknown_phis.ll +++ b/llvm/test/Analysis/ScalarEvolution/unknown_phis.ll @@ -52,7 +52,7 @@ define void @merge_values_with_ranges_looped(ptr %a_len_ptr, ptr %b_len_ptr) { ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 99 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 99 ; CHECK-NEXT: Predicates: -; CHECK: Loop %loop: Trip multiple is 100 +; CHECK-NEXT: Loop %loop: Trip multiple is 100 ; entry: From 50c298fd174f1a98fd20374a65d1faecba5649e1 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 24 Nov 2023 15:50:10 +0100 Subject: [PATCH 30/35] [CVP] Regenerate test checks (NFC) Avoid some spurious changes in a future patch. --- .../CorrelatedValuePropagation/basic.ll | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/llvm/test/Transforms/CorrelatedValuePropagation/basic.ll b/llvm/test/Transforms/CorrelatedValuePropagation/basic.ll index 39285df56ae3cd..0ef48ea8020ec3 100644 --- a/llvm/test/Transforms/CorrelatedValuePropagation/basic.ll +++ b/llvm/test/Transforms/CorrelatedValuePropagation/basic.ll @@ -210,8 +210,8 @@ define i32 @switch1(i32 %s) { ; CHECK-NEXT: br i1 [[CMP]], label [[NEGATIVE:%.*]], label [[OUT:%.*]] ; CHECK: negative: ; CHECK-NEXT: switch i32 [[S]], label [[OUT]] [ -; CHECK-NEXT: i32 -2, label [[NEXT:%.*]] -; CHECK-NEXT: i32 -1, label [[NEXT]] +; CHECK-NEXT: i32 -2, label [[NEXT:%.*]] +; CHECK-NEXT: i32 -1, label [[NEXT]] ; CHECK-NEXT: ] ; CHECK: out: ; CHECK-NEXT: [[P:%.*]] = phi i32 [ 1, [[ENTRY:%.*]] ], [ -1, [[NEGATIVE]] ] @@ -443,9 +443,9 @@ define i32 @switch_range(i32 %cond) { ; CHECK-NEXT: [[S:%.*]] = urem i32 [[COND:%.*]], 3 ; CHECK-NEXT: [[S1:%.*]] = add nuw nsw i32 [[S]], 1 ; CHECK-NEXT: switch i32 [[S1]], label [[UNREACHABLE:%.*]] [ -; CHECK-NEXT: i32 1, label [[EXIT1:%.*]] -; CHECK-NEXT: i32 2, label [[EXIT2:%.*]] -; CHECK-NEXT: i32 3, label [[EXIT1]] +; CHECK-NEXT: i32 1, label [[EXIT1:%.*]] +; CHECK-NEXT: i32 2, label [[EXIT2:%.*]] +; CHECK-NEXT: i32 3, label [[EXIT1]] ; CHECK-NEXT: ] ; CHECK: exit1: ; CHECK-NEXT: ret i32 1 @@ -480,8 +480,8 @@ define i32 @switch_range_not_full(i32 %cond) { ; CHECK-NEXT: [[S:%.*]] = urem i32 [[COND:%.*]], 3 ; CHECK-NEXT: [[S1:%.*]] = add nuw nsw i32 [[S]], 1 ; CHECK-NEXT: switch i32 [[S1]], label [[UNREACHABLE:%.*]] [ -; CHECK-NEXT: i32 1, label [[EXIT1:%.*]] -; CHECK-NEXT: i32 3, label [[EXIT2:%.*]] +; CHECK-NEXT: i32 1, label [[EXIT1:%.*]] +; CHECK-NEXT: i32 3, label [[EXIT2:%.*]] ; CHECK-NEXT: ] ; CHECK: exit1: ; CHECK-NEXT: ret i32 1 @@ -514,8 +514,8 @@ define i8 @switch_defaultdest_multipleuse(i8 %t0) { ; CHECK-NEXT: [[O:%.*]] = or i8 [[T0:%.*]], 1 ; CHECK-NEXT: [[R:%.*]] = srem i8 1, [[O]] ; CHECK-NEXT: switch i8 [[R]], label [[EXIT:%.*]] [ -; CHECK-NEXT: i8 0, label [[EXIT]] -; CHECK-NEXT: i8 1, label [[EXIT]] +; CHECK-NEXT: i8 0, label [[EXIT]] +; CHECK-NEXT: i8 1, label [[EXIT]] ; CHECK-NEXT: ] ; CHECK: exit: ; CHECK-NEXT: ret i8 0 From 5e5a22caf88ac1ccfa8dc5720295fdeba0ad9372 Mon Sep 17 00:00:00 2001 From: Guillaume Chatelet Date: Fri, 24 Nov 2023 16:11:05 +0100 Subject: [PATCH 31/35] [libc][NFC] Move float macro into its own header / add target os detection (#73311) Floating point properties are a combination of target OS, target architecture and compiler support. - Adding target OS detection, - Moving floating point type detection to its own file. This is in preparation of adding support for `_Float16` which requires testing compiler **version** and target architecture. --- .../compiler_features/check_float128.cpp | 2 +- libc/docs/dev/code_style.rst | 6 ++- libc/src/__support/CMakeLists.txt | 2 +- libc/src/__support/CPP/CMakeLists.txt | 2 + .../CPP/type_traits/is_floating_point.h | 2 +- libc/src/__support/FPUtil/CMakeLists.txt | 1 + libc/src/__support/FPUtil/FloatProperties.h | 14 +----- .../macros/properties/CMakeLists.txt | 16 +++++++ .../__support/macros/properties/compiler.h | 21 --------- libc/src/__support/macros/properties/float.h | 46 +++++++++++++++++++ libc/src/__support/macros/properties/os.h | 40 ++++++++++++++++ libc/src/math/copysignf128.h | 2 +- libc/src/math/generic/copysignf128.cpp | 1 - .../llvm-project-overlay/libc/BUILD.bazel | 18 +++++++- 14 files changed, 132 insertions(+), 41 deletions(-) create mode 100644 libc/src/__support/macros/properties/float.h create mode 100644 libc/src/__support/macros/properties/os.h diff --git a/libc/cmake/modules/compiler_features/check_float128.cpp b/libc/cmake/modules/compiler_features/check_float128.cpp index 1dcfe80da0a0eb..8b1e3fe04ed4e1 100644 --- a/libc/cmake/modules/compiler_features/check_float128.cpp +++ b/libc/cmake/modules/compiler_features/check_float128.cpp @@ -1,4 +1,4 @@ -#include "src/__support/macros/properties/compiler.h" +#include "src/__support/macros/properties/float.h" #ifndef LIBC_COMPILER_HAS_FLOAT128 #error unsupported diff --git a/libc/docs/dev/code_style.rst b/libc/docs/dev/code_style.rst index a28f7b9d717d4d..a050a4c1d3dd7d 100644 --- a/libc/docs/dev/code_style.rst +++ b/libc/docs/dev/code_style.rst @@ -45,8 +45,12 @@ We define two kinds of macros: e.g., ``LIBC_TARGET_ARCH_IS_ARM``. * ``compiler.h`` - Host compiler properties. e.g., ``LIBC_COMPILER_IS_CLANG``. - * ``cpu_features.h`` - Target cpu apu feature availability. + * ``cpu_features.h`` - Target cpu feature availability. e.g., ``LIBC_TARGET_CPU_HAS_AVX2``. + * ``float.h`` - Floating point type properties and availability. + e.g., ``LIBC_COMPILER_HAS_FLOAT128``. + * ``os.h`` - Target os properties. + e.g., ``LIBC_TARGET_OS_IS_LINUX``. * ``src/__support/macros/config.h`` - Important compiler and platform features. Such macros can be used to produce portable code by diff --git a/libc/src/__support/CMakeLists.txt b/libc/src/__support/CMakeLists.txt index 8f66209ab54c55..b939fae3be791d 100644 --- a/libc/src/__support/CMakeLists.txt +++ b/libc/src/__support/CMakeLists.txt @@ -42,7 +42,7 @@ add_header_library( .named_pair libc.src.__support.CPP.type_traits libc.src.__support.macros.attributes - libc.src.__support.macros.properties.compiler + libc.src.__support.macros.config ) add_header_library( diff --git a/libc/src/__support/CPP/CMakeLists.txt b/libc/src/__support/CPP/CMakeLists.txt index 6853bfa3b304a3..c75fae05fedfcd 100644 --- a/libc/src/__support/CPP/CMakeLists.txt +++ b/libc/src/__support/CPP/CMakeLists.txt @@ -147,6 +147,8 @@ add_header_library( type_traits/true_type.h type_traits/type_identity.h type_traits/void_t.h + DEPENDS + libc.src.__support.macros.properties.float ) add_header_library( diff --git a/libc/src/__support/CPP/type_traits/is_floating_point.h b/libc/src/__support/CPP/type_traits/is_floating_point.h index bcd20410299754..3a5260bcab11ee 100644 --- a/libc/src/__support/CPP/type_traits/is_floating_point.h +++ b/libc/src/__support/CPP/type_traits/is_floating_point.h @@ -11,7 +11,7 @@ #include "src/__support/CPP/type_traits/is_same.h" #include "src/__support/CPP/type_traits/remove_cv.h" #include "src/__support/macros/attributes.h" -#include "src/__support/macros/properties/compiler.h" +#include "src/__support/macros/properties/float.h" namespace LIBC_NAMESPACE::cpp { diff --git a/libc/src/__support/FPUtil/CMakeLists.txt b/libc/src/__support/FPUtil/CMakeLists.txt index 7cfa4481079e15..58a182eaa797bc 100644 --- a/libc/src/__support/FPUtil/CMakeLists.txt +++ b/libc/src/__support/FPUtil/CMakeLists.txt @@ -28,6 +28,7 @@ add_header_library( HDRS FloatProperties.h DEPENDS + libc.src.__support.macros.properties.float libc.src.__support.uint128 ) diff --git a/libc/src/__support/FPUtil/FloatProperties.h b/libc/src/__support/FPUtil/FloatProperties.h index 35d6a14a9d3237..9d91688e023e92 100644 --- a/libc/src/__support/FPUtil/FloatProperties.h +++ b/libc/src/__support/FPUtil/FloatProperties.h @@ -10,22 +10,10 @@ #define LLVM_LIBC_SRC___SUPPORT_FPUTIL_FLOATPROPERTIES_H #include "src/__support/UInt128.h" -#include "src/__support/macros/properties/architectures.h" // LIBC_TARGET_ARCH_XXX +#include "src/__support/macros/properties/float.h" // LIBC_COMPILER_HAS_FLOAT128 #include -// https://developer.arm.com/documentation/dui0491/i/C-and-C---Implementation-Details/Basic-data-types -// https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms -// https://docs.amd.com/bundle/HIP-Programming-Guide-v5.1/page/Programming_with_HIP.html -#if defined(_WIN32) || defined(__arm__) || defined(__NVPTX__) || \ - defined(__AMDGPU__) || (defined(__APPLE__) && defined(__aarch64__)) -#define LONG_DOUBLE_IS_DOUBLE -#endif - -#if !defined(LONG_DOUBLE_IS_DOUBLE) && defined(LIBC_TARGET_ARCH_IS_X86) -#define SPECIAL_X86_LONG_DOUBLE -#endif - namespace LIBC_NAMESPACE { namespace fputil { diff --git a/libc/src/__support/macros/properties/CMakeLists.txt b/libc/src/__support/macros/properties/CMakeLists.txt index f6c88c34ebb5a0..e37cdb78bfa2c5 100644 --- a/libc/src/__support/macros/properties/CMakeLists.txt +++ b/libc/src/__support/macros/properties/CMakeLists.txt @@ -10,6 +10,12 @@ add_header_library( compiler.h ) +add_header_library( + os + HDRS + os.h +) + add_header_library( cpu_features HDRS @@ -17,3 +23,13 @@ add_header_library( DEPENDS .architectures ) + +add_header_library( + float + HDRS + float.h + DEPENDS + .architectures + .compiler + .os +) diff --git a/libc/src/__support/macros/properties/compiler.h b/libc/src/__support/macros/properties/compiler.h index 3805d1f9a7a505..a7a2822bf6a14a 100644 --- a/libc/src/__support/macros/properties/compiler.h +++ b/libc/src/__support/macros/properties/compiler.h @@ -21,25 +21,4 @@ #define LIBC_COMPILER_IS_MSC #endif -// Check compiler features -#if defined(FLT128_MANT_DIG) -// C23 _Float128 type is available. -#define LIBC_COMPILER_HAS_FLOAT128 -#define LIBC_FLOAT128_IS_C23 -using float128 = _Float128; - -#elif defined(__SIZEOF_FLOAT128__) -// Builtin __float128 is available. -#define LIBC_COMPILER_HAS_FLOAT128 -#define LIBC_FLOAT128_IS_BUILTIN -using float128 = __float128; - -#elif (defined(__linux__) && defined(__aarch64__)) -// long double on Linux aarch64 is 128-bit floating point. -#define LIBC_COMPILER_HAS_FLOAT128 -#define LIBC_FLOAT128_IS_LONG_DOUBLE -using float128 = long double; - -#endif - #endif // LLVM_LIBC_SRC___SUPPORT_MACROS_PROPERTIES_COMPILER_H diff --git a/libc/src/__support/macros/properties/float.h b/libc/src/__support/macros/properties/float.h new file mode 100644 index 00000000000000..c40ca6120e4753 --- /dev/null +++ b/libc/src/__support/macros/properties/float.h @@ -0,0 +1,46 @@ +//===-- Float type support --------------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// Floating point properties are a combination of compiler support, target OS +// and target architecture. + +#ifndef LLVM_LIBC_SRC___SUPPORT_MACROS_PROPERTIES_FLOAT_H +#define LLVM_LIBC_SRC___SUPPORT_MACROS_PROPERTIES_FLOAT_H + +#include "src/__support/macros/properties/architectures.h" +#include "src/__support/macros/properties/compiler.h" +#include "src/__support/macros/properties/os.h" + +// https://developer.arm.com/documentation/dui0491/i/C-and-C---Implementation-Details/Basic-data-types +// https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms +// https://docs.amd.com/bundle/HIP-Programming-Guide-v5.1/page/Programming_with_HIP.html +#if defined(LIBC_TARGET_OS_IS_WINDOWS) || \ + (defined(LIBC_TARGET_OS_IS_MACOS) && \ + defined(LIBC_TARGET_ARCH_IS_AARCH64)) || \ + defined(LIBC_TARGET_ARCH_IS_ARM) || defined(LIBC_TARGET_ARCH_IS_NVPTX) || \ + defined(LIBC_TARGET_ARCH_IS_AMDGPU) +#define LONG_DOUBLE_IS_DOUBLE +#endif + +#if !defined(LONG_DOUBLE_IS_DOUBLE) && defined(LIBC_TARGET_ARCH_IS_X86) +#define SPECIAL_X86_LONG_DOUBLE +#endif + +// Check compiler features +#if defined(FLT128_MANT_DIG) +#define LIBC_COMPILER_HAS_FLOAT128 +using float128 = _Float128; +#elif defined(__SIZEOF_FLOAT128__) +#define LIBC_COMPILER_HAS_FLOAT128 +using float128 = __float128; +#elif (defined(__linux__) && defined(__aarch64__)) +#define LIBC_COMPILER_HAS_FLOAT128 +#define LIBC_FLOAT128_IS_LONG_DOUBLE +using float128 = long double; +#endif + +#endif // LLVM_LIBC_SRC___SUPPORT_MACROS_PROPERTIES_FLOAT_H diff --git a/libc/src/__support/macros/properties/os.h b/libc/src/__support/macros/properties/os.h new file mode 100644 index 00000000000000..92e68b3e6612a8 --- /dev/null +++ b/libc/src/__support/macros/properties/os.h @@ -0,0 +1,40 @@ +//===-- Target OS detection -------------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +#ifndef LLVM_LIBC_SRC___SUPPORT_MACROS_PROPERTIES_OS_H +#define LLVM_LIBC_SRC___SUPPORT_MACROS_PROPERTIES_OS_H + +#if (defined(__freebsd__) || defined(__FreeBSD__)) +#define LIBC_TARGET_OS_IS_FREEBSD +#endif + +#if defined(__ANDROID__) +#define LIBC_TARGET_OS_IS_ANDROID +#endif + +#if defined(__linux__) && !defined(LIBC_TARGET_OS_IS_FREEBSD) && \ + !defined(LIBC_TARGET_OS_IS_ANDROID) +#define LIBC_TARGET_OS_IS_LINUX +#endif + +#if (defined(_WIN64) || defined(_WIN32)) +#define LIBC_TARGET_OS_IS_WINDOWS +#endif + +#if (defined(__apple__) || defined(__APPLE__) || defined(__MACH__)) +// From https://stackoverflow.com/a/49560690 +#include "TargetConditionals.h" +#if defined(TARGET_OS_OSX) +#define LIBC_TARGET_OS_IS_MACOS +#endif +#if defined(TARGET_OS_IPHONE) +// This is set for any non-Mac Apple products (IOS, TV, WATCH) +#define LIBC_TARGET_OS_IS_IPHONE +#endif +#endif + +#endif // LLVM_LIBC_SRC___SUPPORT_MACROS_PROPERTIES_OS_H diff --git a/libc/src/math/copysignf128.h b/libc/src/math/copysignf128.h index 9448d8205dd752..5e40657de33be3 100644 --- a/libc/src/math/copysignf128.h +++ b/libc/src/math/copysignf128.h @@ -9,7 +9,7 @@ #ifndef LLVM_LIBC_SRC_MATH_COPYSIGNF128_H #define LLVM_LIBC_SRC_MATH_COPYSIGNF128_H -#include "src/__support/macros/properties/compiler.h" +#include "src/__support/macros/properties/float.h" namespace LIBC_NAMESPACE { diff --git a/libc/src/math/generic/copysignf128.cpp b/libc/src/math/generic/copysignf128.cpp index 07e5caa223a534..2fe36d52d01dca 100644 --- a/libc/src/math/generic/copysignf128.cpp +++ b/libc/src/math/generic/copysignf128.cpp @@ -9,7 +9,6 @@ #include "src/math/copysignf128.h" #include "src/__support/FPUtil/ManipulationFunctions.h" #include "src/__support/common.h" -#include "src/__support/macros/properties/compiler.h" namespace LIBC_NAMESPACE { diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel index 19573d83b12b3b..e7dc978b0dbe84 100644 --- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel @@ -75,6 +75,21 @@ libc_support_library( hdrs = ["src/__support/macros/properties/compiler.h"], ) +libc_support_library( + name = "__support_macros_properties_os", + hdrs = ["src/__support/macros/properties/os.h"], +) + +libc_support_library( + name = "__support_macros_properties_float", + hdrs = ["src/__support/macros/properties/float.h"], + deps = [ + ":__support_macros_properties_architectures", + ":__support_macros_properties_compiler", + ":__support_macros_properties_os", + ], +) + libc_support_library( name = "__support_macros_properties_cpu_features", hdrs = ["src/__support/macros/properties/cpu_features.h"], @@ -308,7 +323,7 @@ libc_support_library( deps = [ ":__support_macros_attributes", ":__support_macros_config", - ":__support_macros_properties_compiler", + ":__support_macros_properties_float", ], ) @@ -657,6 +672,7 @@ libc_support_library( name = "__support_fputil_float_properties", hdrs = ["src/__support/FPUtil/FloatProperties.h"], deps = [ + ":__support_macros_properties_float", ":__support_uint128", ], ) From 2f7c050e1943f63af0823c1327b44579d0bdb584 Mon Sep 17 00:00:00 2001 From: Jeremy Morse Date: Wed, 15 Nov 2023 16:39:11 +0000 Subject: [PATCH 32/35] [DebugInfo][RemoveDIs] Allow speculative-DPMarker creation There's good justification for having a function specifying "I need there to be a marker here, so return the marker there or create a new one". This was going to come later in the series, but it's starting to become necessary much eariler alas. Make use of it in spliceDebugInfo, where we can occasionally splice DPValues onto the end() iterator of a block while it's been edited. --- llvm/lib/IR/BasicBlock.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/llvm/lib/IR/BasicBlock.cpp b/llvm/lib/IR/BasicBlock.cpp index 7037f5f524ee06..6c08ca1efc6528 100644 --- a/llvm/lib/IR/BasicBlock.cpp +++ b/llvm/lib/IR/BasicBlock.cpp @@ -39,8 +39,8 @@ cl::opt DPMarker *BasicBlock::createMarker(Instruction *I) { assert(IsNewDbgInfoFormat && "Tried to create a marker in a non new debug-info block!"); - assert(I->DbgMarker == nullptr && - "Tried to create marker for instuction that already has one!"); + if (I->DbgMarker) + return I->DbgMarker; DPMarker *Marker = new DPMarker(); Marker->MarkedInstr = I; I->DbgMarker = Marker; @@ -918,8 +918,8 @@ void BasicBlock::spliceDebugInfo(BasicBlock::iterator Dest, BasicBlock *Src, // move their markers onto Last. They remain in the Src block. No action // needed. if (!ReadFromHead) { - DPMarker *OntoLast = Src->getMarker(Last); - DPMarker *FromFirst = Src->getMarker(First); + DPMarker *OntoLast = Src->createMarker(Last); + DPMarker *FromFirst = Src->createMarker(First); OntoLast->absorbDebugValues(*FromFirst, true); // Always insert at head of it. } From 59fab2264217648ff11412666b69fb4c5fc9451c Mon Sep 17 00:00:00 2001 From: Jeremy Morse Date: Wed, 7 Jun 2023 16:00:15 +0100 Subject: [PATCH 33/35] [DebugInfo][RemoveDIs] Support cloning and remapping DPValues (#72546) This patch adds support for CloneBasicBlock duplicating the DPValues attached to instructions, and adds facilities to remap them into their new context. The plumbing to achieve this is fairly straightforwards and mechanical. I've also added illustrative uses to LoopUnrollRuntime, SimpleLoopUnswitch and SimplifyCFG. The former only updates for the epilogue right now so I've added CHECK lines just for the end of an unrolled loop (further updates coming later). SimpleLoopUnswitch had no debug-info tests so I've added a new one. The two modified parts of SimplifyCFG are covered by the two modified SimplifyCFG tests. These are scenarios where we have to do extra cloning for copying of DPValues because they're no longer instructions, and remap them too. --- .../llvm/Transforms/Utils/ValueMapper.h | 23 ++++ .../Transforms/Scalar/SimpleLoopUnswitch.cpp | 3 + llvm/lib/Transforms/Utils/CloneFunction.cpp | 5 +- .../Transforms/Utils/LoopUnrollRuntime.cpp | 3 + llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 30 +++++ llvm/lib/Transforms/Utils/ValueMapper.cpp | 46 ++++++++ .../LoopUnroll/runtime-epilog-debuginfo.ll | 13 +++ .../SimpleLoopUnswitch/debuginfo.ll | 108 ++++++++++++++++++ .../Transforms/SimplifyCFG/branch-fold-dbg.ll | 1 + .../SimplifyCFG/jump-threading-debuginfo.ll | 95 +++++++++++++++ 10 files changed, 326 insertions(+), 1 deletion(-) create mode 100644 llvm/test/Transforms/SimpleLoopUnswitch/debuginfo.ll create mode 100644 llvm/test/Transforms/SimplifyCFG/jump-threading-debuginfo.ll diff --git a/llvm/include/llvm/Transforms/Utils/ValueMapper.h b/llvm/include/llvm/Transforms/Utils/ValueMapper.h index e80951d50d56e8..eedd25f898c016 100644 --- a/llvm/include/llvm/Transforms/Utils/ValueMapper.h +++ b/llvm/include/llvm/Transforms/Utils/ValueMapper.h @@ -15,21 +15,26 @@ #define LLVM_TRANSFORMS_UTILS_VALUEMAPPER_H #include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/simple_ilist.h" #include "llvm/IR/ValueHandle.h" #include "llvm/IR/ValueMap.h" namespace llvm { class Constant; +class DIBuilder; +class DPValue; class Function; class GlobalVariable; class Instruction; class MDNode; class Metadata; +class Module; class Type; class Value; using ValueToValueMapTy = ValueMap; +using DPValueIterator = simple_ilist::iterator; /// This is a class that can be implemented by clients to remap types when /// cloning constants and instructions. @@ -175,6 +180,8 @@ class ValueMapper { Constant *mapConstant(const Constant &C); void remapInstruction(Instruction &I); + void remapDPValue(Module *M, DPValue &V); + void remapDPValueRange(Module *M, iterator_range Range); void remapFunction(Function &F); void remapGlobalObjectMetadata(GlobalObject &GO); @@ -260,6 +267,22 @@ inline void RemapInstruction(Instruction *I, ValueToValueMapTy &VM, ValueMapper(VM, Flags, TypeMapper, Materializer).remapInstruction(*I); } +/// Remap the Values used in the DPValue \a V using the value map \a VM. +inline void RemapDPValue(Module *M, DPValue *V, ValueToValueMapTy &VM, + RemapFlags Flags = RF_None, + ValueMapTypeRemapper *TypeMapper = nullptr, + ValueMaterializer *Materializer = nullptr) { + ValueMapper(VM, Flags, TypeMapper, Materializer).remapDPValue(M, *V); +} + +/// Remap the Values used in the DPValue \a V using the value map \a VM. +inline void RemapDPValueRange(Module *M, iterator_range Range, + ValueToValueMapTy &VM, RemapFlags Flags = RF_None, + ValueMapTypeRemapper *TypeMapper = nullptr, + ValueMaterializer *Materializer = nullptr) { + ValueMapper(VM, Flags, TypeMapper, Materializer).remapDPValueRange(M, Range); +} + /// Remap the operands, metadata, arguments, and instructions of a function. /// /// Calls \a MapValue() on prefix data, prologue data, and personality diff --git a/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp index 55606473765239..5ca2aec636bb3c 100644 --- a/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp +++ b/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp @@ -1257,8 +1257,11 @@ static BasicBlock *buildClonedLoopBlocks( // everything available. Also, we have inserted new instructions which may // include assume intrinsics, so we update the assumption cache while // processing this. + Module *M = ClonedPH->getParent()->getParent(); for (auto *ClonedBB : NewBlocks) for (Instruction &I : *ClonedBB) { + RemapDPValueRange(M, I.getDbgValueRange(), VMap, + RF_NoModuleLevelChanges | RF_IgnoreMissingLocals); RemapInstruction(&I, VMap, RF_NoModuleLevelChanges | RF_IgnoreMissingLocals); if (auto *II = dyn_cast(&I)) diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp index 94c6abcf7b4e1a..9ff4f01a9809e5 100644 --- a/llvm/lib/Transforms/Utils/CloneFunction.cpp +++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp @@ -59,7 +59,10 @@ BasicBlock *llvm::CloneBasicBlock(const BasicBlock *BB, ValueToValueMapTy &VMap, Instruction *NewInst = I.clone(); if (I.hasName()) NewInst->setName(I.getName() + NameSuffix); - NewInst->insertInto(NewBB, NewBB->end()); + + NewInst->insertBefore(*NewBB, NewBB->end()); + NewInst->cloneDebugInfoFrom(&I); + VMap[&I] = NewInst; // Add instruction map to value. if (isa(I) && !I.isDebugOrPseudoInst()) { diff --git a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp index 1c8850048f6ab1..612f6997088140 100644 --- a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp +++ b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp @@ -913,9 +913,12 @@ bool llvm::UnrollRuntimeLoopRemainder( // Rewrite the cloned instruction operands to use the values created when the // clone is created. for (BasicBlock *BB : NewBlocks) { + Module *M = BB->getModule(); for (Instruction &I : *BB) { RemapInstruction(&I, VMap, RF_NoModuleLevelChanges | RF_IgnoreMissingLocals); + RemapDPValueRange(M, I.getDbgValueRange(), VMap, + RF_NoModuleLevelChanges | RF_IgnoreMissingLocals); } } diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 3bcd896639a8ec..c09cf9c2325c40 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1126,6 +1126,9 @@ static void CloneInstructionsIntoPredecessorBlockAndUpdateSSAUses( NewBonusInst->dropUBImplyingAttrsAndMetadata(); NewBonusInst->insertInto(PredBlock, PTI->getIterator()); + auto Range = NewBonusInst->cloneDebugInfoFrom(&BonusInst); + RemapDPValueRange(NewBonusInst->getModule(), Range, VMap, + RF_NoModuleLevelChanges | RF_IgnoreMissingLocals); if (isa(BonusInst)) continue; @@ -3303,6 +3306,10 @@ FoldCondBranchOnValueKnownInPredecessorImpl(BranchInst *BI, DomTreeUpdater *DTU, BasicBlock::iterator InsertPt = EdgeBB->getFirstInsertionPt(); DenseMap TranslateMap; // Track translated values. TranslateMap[Cond] = CB; + + // RemoveDIs: track instructions that we optimise away while folding, so + // that we can copy DPValues from them later. + BasicBlock::iterator SrcDbgCursor = BB->begin(); for (BasicBlock::iterator BBI = BB->begin(); &*BBI != BI; ++BBI) { if (PHINode *PN = dyn_cast(BBI)) { TranslateMap[PN] = PN->getIncomingValueForBlock(EdgeBB); @@ -3337,6 +3344,15 @@ FoldCondBranchOnValueKnownInPredecessorImpl(BranchInst *BI, DomTreeUpdater *DTU, TranslateMap[&*BBI] = N; } if (N) { + // Copy all debug-info attached to instructions from the last we + // successfully clone, up to this instruction (they might have been + // folded away). + for (; SrcDbgCursor != BBI; ++SrcDbgCursor) + N->cloneDebugInfoFrom(&*SrcDbgCursor); + SrcDbgCursor = std::next(BBI); + // Clone debug-info on this instruction too. + N->cloneDebugInfoFrom(&*BBI); + // Register the new instruction with the assumption cache if necessary. if (auto *Assume = dyn_cast(N)) if (AC) @@ -3344,6 +3360,10 @@ FoldCondBranchOnValueKnownInPredecessorImpl(BranchInst *BI, DomTreeUpdater *DTU, } } + for (; &*SrcDbgCursor != BI; ++SrcDbgCursor) + InsertPt->cloneDebugInfoFrom(&*SrcDbgCursor); + InsertPt->cloneDebugInfoFrom(BI); + BB->removePredecessor(EdgeBB); BranchInst *EdgeBI = cast(EdgeBB->getTerminator()); EdgeBI->setSuccessor(0, RealDest); @@ -3748,6 +3768,16 @@ static bool performBranchToCommonDestFolding(BranchInst *BI, BranchInst *PBI, ValueToValueMapTy VMap; // maps original values to cloned values CloneInstructionsIntoPredecessorBlockAndUpdateSSAUses(BB, PredBlock, VMap); + Module *M = BB->getModule(); + + if (PredBlock->IsNewDbgInfoFormat) { + PredBlock->getTerminator()->cloneDebugInfoFrom(BB->getTerminator()); + for (DPValue &DPV : PredBlock->getTerminator()->getDbgValueRange()) { + RemapDPValue(M, &DPV, VMap, + RF_NoModuleLevelChanges | RF_IgnoreMissingLocals); + } + } + // Now that the Cond was cloned into the predecessor basic block, // or/and the two conditions together. Value *BICond = VMap[BI->getCondition()]; diff --git a/llvm/lib/Transforms/Utils/ValueMapper.cpp b/llvm/lib/Transforms/Utils/ValueMapper.cpp index 3446e31cc2ef17..71d0f09e47713b 100644 --- a/llvm/lib/Transforms/Utils/ValueMapper.cpp +++ b/llvm/lib/Transforms/Utils/ValueMapper.cpp @@ -31,6 +31,7 @@ #include "llvm/IR/InlineAsm.h" #include "llvm/IR/Instruction.h" #include "llvm/IR/Instructions.h" +#include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/Metadata.h" #include "llvm/IR/Operator.h" #include "llvm/IR/Type.h" @@ -145,6 +146,7 @@ class Mapper { Value *mapValue(const Value *V); void remapInstruction(Instruction *I); void remapFunction(Function &F); + void remapDPValue(DPValue &DPV); Constant *mapConstant(const Constant *C) { return cast_or_null(mapValue(C)); @@ -535,6 +537,39 @@ Value *Mapper::mapValue(const Value *V) { return getVM()[V] = ConstantPointerNull::get(cast(NewTy)); } +void Mapper::remapDPValue(DPValue &V) { + // Remap variables and DILocations. + auto *MappedVar = mapMetadata(V.getVariable()); + auto *MappedDILoc = mapMetadata(V.getDebugLoc()); + V.setVariable(cast(MappedVar)); + V.setDebugLoc(DebugLoc(cast(MappedDILoc))); + + // Find Value operands and remap those. + SmallVector Vals, NewVals; + for (Value *Val : V.location_ops()) + Vals.push_back(Val); + for (Value *Val : Vals) + NewVals.push_back(mapValue(Val)); + + // If there are no changes to the Value operands, finished. + if (Vals == NewVals) + return; + + bool IgnoreMissingLocals = Flags & RF_IgnoreMissingLocals; + + // Otherwise, do some replacement. + if (!IgnoreMissingLocals && + llvm::any_of(NewVals, [&](Value *V) { return V == nullptr; })) { + V.setKillLocation(); + } else { + // Either we have all non-empty NewVals, or we're permitted to ignore + // missing locals. + for (unsigned int I = 0; I < Vals.size(); ++I) + if (NewVals[I]) + V.replaceVariableLocationOp(I, NewVals[I]); + } +} + Value *Mapper::mapBlockAddress(const BlockAddress &BA) { Function *F = cast(mapValue(BA.getFunction())); @@ -1179,6 +1214,17 @@ void ValueMapper::remapInstruction(Instruction &I) { FlushingMapper(pImpl)->remapInstruction(&I); } +void ValueMapper::remapDPValue(Module *M, DPValue &V) { + FlushingMapper(pImpl)->remapDPValue(V); +} + +void ValueMapper::remapDPValueRange( + Module *M, iterator_range Range) { + for (DPValue &DPV : Range) { + remapDPValue(M, DPV); + } +} + void ValueMapper::remapFunction(Function &F) { FlushingMapper(pImpl)->remapFunction(F); } diff --git a/llvm/test/Transforms/LoopUnroll/runtime-epilog-debuginfo.ll b/llvm/test/Transforms/LoopUnroll/runtime-epilog-debuginfo.ll index bd5d68c5b9af37..4de90c3a00a69c 100644 --- a/llvm/test/Transforms/LoopUnroll/runtime-epilog-debuginfo.ll +++ b/llvm/test/Transforms/LoopUnroll/runtime-epilog-debuginfo.ll @@ -1,4 +1,5 @@ ; RUN: opt -passes=loop-unroll -unroll-runtime -unroll-runtime-epilog -S %s | FileCheck %s +; RUN: opt -passes=loop-unroll -unroll-runtime -unroll-runtime-epilog -S %s --try-experimental-debuginfo-iterators | FileCheck %s ; Test that epilogue is tagged with the same debug information as original loop body rather than original loop exit. @@ -11,6 +12,18 @@ ; CHECK: br i1 %lcmp.mod, label %for.body.i.epil.preheader, label %lee1.exit.loopexit, !dbg ![[LOOP_LOC]] ; CHECK: for.body.i.epil.preheader: ; CHECK: br label %for.body.i.epil, !dbg ![[LOOP_LOC]] +; CHECK: for.body.i.epil: +;; Ensure that when we clone the div/add/add and its following dbg.values, +;; those dbg.values are remapped to the duplicated adds, not the originals. +; CHECK: %div.i.epil = sdiv i32 %t.08.i.epil, 2, +; CHECK-NEXT: %add.i.epil = add i32 %t.08.i.epil, %a, +; CHECK-NEXT: %add1.i.epil = add i32 %add.i.epil, %div.i.epil, +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 %add1.i.epil, +; CHECK-NEXT: %inc.i.epil = add nuw i32 %i.09.i.epil, 1, !dbg !36 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 %inc.i.epil, +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 %inc.i.epil, +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 %add1.i.epil, + ; CHECK: lee1.exit.loopexit: ; CHECK: br label %lee1.exit, !dbg ![[EXIT_LOC:[0-9]+]] diff --git a/llvm/test/Transforms/SimpleLoopUnswitch/debuginfo.ll b/llvm/test/Transforms/SimpleLoopUnswitch/debuginfo.ll new file mode 100644 index 00000000000000..ca3691dff9d183 --- /dev/null +++ b/llvm/test/Transforms/SimpleLoopUnswitch/debuginfo.ll @@ -0,0 +1,108 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt -passes='loop-mssa(simple-loop-unswitch),verify' -S < %s | FileCheck %s +; RUN: opt -passes='loop-mssa(simple-loop-unswitch),verify' -S < %s --try-experimental-debuginfo-iterators | FileCheck %s +; +;; Check that when we duplicate the load in the loop header, we also duplicate +;; the corresponding dbg.value. +;; FIXME: the hoisted load dominates the duplicated dbg.value, however as it's +;; not subsequently used in the loop, so it doesn't get remapped into the +;; debug user and we get a undef/poison dbg.value. This is suboptimal, but it's +;; important that the dbg.value gets duplicated nonetheless. + +declare void @clobber() +declare void @llvm.dbg.value(metadata, metadata, metadata) + +define i32 @partial_unswitch_true_successor(ptr %ptr, i32 %N) { +; CHECK-LABEL: @partial_unswitch_true_successor( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[PTR:%.*]], align 4 +; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i32 [[TMP0]], 100 +; CHECK-NEXT: br i1 [[TMP1]], label [[ENTRY_SPLIT_US:%.*]], label [[ENTRY_SPLIT:%.*]] +; CHECK: entry.split.us: +; CHECK-NEXT: br label [[LOOP_HEADER_US:%.*]] +; CHECK: loop.header.us: +; CHECK-NEXT: [[IV_US:%.*]] = phi i32 [ 0, [[ENTRY_SPLIT_US]] ], [ [[IV_NEXT_US:%.*]], [[LOOP_LATCH_US:%.*]] ] +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 poison, metadata [[META3:![0-9]+]], metadata !DIExpression()), !dbg [[DBG8:![0-9]+]] +; CHECK-NEXT: br label [[NOCLOBBER_US:%.*]] +; CHECK: noclobber.us: +; CHECK-NEXT: br label [[LOOP_LATCH_US]] +; CHECK: loop.latch.us: +; CHECK-NEXT: [[C_US:%.*]] = icmp ult i32 [[IV_US]], [[N:%.*]] +; CHECK-NEXT: [[IV_NEXT_US]] = add i32 [[IV_US]], 1 +; CHECK-NEXT: br i1 [[C_US]], label [[LOOP_HEADER_US]], label [[EXIT_SPLIT_US:%.*]] +; CHECK: exit.split.us: +; CHECK-NEXT: br label [[EXIT:%.*]] +; CHECK: entry.split: +; CHECK-NEXT: br label [[LOOP_HEADER:%.*]] +; CHECK: loop.header: +; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY_SPLIT]] ], [ [[IV_NEXT:%.*]], [[LOOP_LATCH:%.*]] ] +; CHECK-NEXT: [[LV:%.*]] = load i32, ptr [[PTR]], align 4 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[LV]], metadata [[META3]], metadata !DIExpression()), !dbg [[DBG8]] +; CHECK-NEXT: [[SC:%.*]] = icmp eq i32 [[LV]], 100 +; CHECK-NEXT: br i1 [[SC]], label [[NOCLOBBER:%.*]], label [[CLOBBER:%.*]] +; CHECK: noclobber: +; CHECK-NEXT: br label [[LOOP_LATCH]] +; CHECK: clobber: +; CHECK-NEXT: call void @clobber() +; CHECK-NEXT: br label [[LOOP_LATCH]] +; CHECK: loop.latch: +; CHECK-NEXT: [[C:%.*]] = icmp ult i32 [[IV]], [[N]] +; CHECK-NEXT: [[IV_NEXT]] = add i32 [[IV]], 1 +; CHECK-NEXT: br i1 [[C]], label [[LOOP_HEADER]], label [[EXIT_SPLIT:%.*]], !llvm.loop [[LOOP9:![0-9]+]] +; CHECK: exit.split: +; CHECK-NEXT: br label [[EXIT]] +; CHECK: exit: +; CHECK-NEXT: ret i32 10 +; +entry: + br label %loop.header + +loop.header: + %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop.latch ] + %lv = load i32, ptr %ptr + call void @llvm.dbg.value(metadata i32 %lv, metadata !6, metadata !DIExpression()), !dbg !7 + %sc = icmp eq i32 %lv, 100 + br i1 %sc, label %noclobber, label %clobber + +noclobber: + br label %loop.latch + +clobber: + call void @clobber() + br label %loop.latch + +loop.latch: + %c = icmp ult i32 %iv, %N + %iv.next = add i32 %iv, 1 + br i1 %c, label %loop.header, label %exit + +exit: + ret i32 10 +} + +!llvm.module.flags = !{!21} +!llvm.dbg.cu = !{!2} + +!0 = distinct !DISubprogram(name: "foo", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !2, file: !20, scope: !1, type: !3) +!1 = !DIFile(filename: "b.c", directory: "/private/tmp") +!2 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang", isOptimized: true, emissionKind: FullDebug, file: !20) +!3 = !DISubroutineType(types: !4) +!4 = !{!5} +!5 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) +!6 = !DILocalVariable(name: "i", line: 2, arg: 1, scope: !0, file: !1, type: !5) +!7 = !DILocation(line: 2, column: 13, scope: !0) +!9 = !DILocalVariable(name: "k", line: 3, scope: !10, file: !1, type: !5) +!10 = distinct !DILexicalBlock(line: 2, column: 16, file: !20, scope: !0) +!11 = !DILocation(line: 3, column: 12, scope: !10) +!12 = !DILocation(line: 4, column: 3, scope: !10) +!13 = !DILocation(line: 5, column: 5, scope: !14) +!14 = distinct !DILexicalBlock(line: 4, column: 10, file: !20, scope: !10) +!15 = !DILocation(line: 6, column: 3, scope: !14) +!16 = !DILocation(line: 7, column: 5, scope: !17) +!17 = distinct !DILexicalBlock(line: 6, column: 10, file: !20, scope: !10) +!18 = !DILocation(line: 8, column: 3, scope: !17) +!19 = !DILocation(line: 9, column: 3, scope: !10) +!20 = !DIFile(filename: "b.c", directory: "/private/tmp") +!21 = !{i32 1, !"Debug Info Version", i32 3} + + diff --git a/llvm/test/Transforms/SimplifyCFG/branch-fold-dbg.ll b/llvm/test/Transforms/SimplifyCFG/branch-fold-dbg.ll index e8b8cc6edafe0c..833d72773cdc83 100644 --- a/llvm/test/Transforms/SimplifyCFG/branch-fold-dbg.ll +++ b/llvm/test/Transforms/SimplifyCFG/branch-fold-dbg.ll @@ -1,5 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S < %s | FileCheck %s +; RUN: opt -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S < %s --try-experimental-debuginfo-iterators | FileCheck %s %0 = type { ptr, ptr } diff --git a/llvm/test/Transforms/SimplifyCFG/jump-threading-debuginfo.ll b/llvm/test/Transforms/SimplifyCFG/jump-threading-debuginfo.ll new file mode 100644 index 00000000000000..ad88d23706c990 --- /dev/null +++ b/llvm/test/Transforms/SimplifyCFG/jump-threading-debuginfo.ll @@ -0,0 +1,95 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt -S -passes=simplifycfg < %s | FileCheck %s +;; Test that we correct clone debug-info when folding in +;; FoldCondBranchOnValueKnownInPredecessorImpl. There should be two paths +;; through this program, assigning [0 1 2 3 4 5 6 7] to the variable down +;; one path, and [0 1 2 3 6 7] down the other. + +declare void @foo() +declare void @bar() +declare void @use.i1(i1) +declare void @use.i32(i32) +declare void @llvm.dbg.value(metadata, metadata, metadata) + +define void @test_phi_extra_use(i1 %c) { +; CHECK-LABEL: @test_phi_extra_use( +; CHECK-NEXT: br i1 [[C:%.*]], label [[IF:%.*]], label [[ELSE:%.*]] +; CHECK: if: +; CHECK-NEXT: call void @foo() +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 0, metadata [[META7:![0-9]+]], metadata !DIExpression()), !dbg [[DBG13:![0-9]+]] +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 1, metadata [[META7]], metadata !DIExpression()), !dbg [[DBG13]] +; CHECK-NEXT: call void @use.i1(i1 true) +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 2, metadata [[META7]], metadata !DIExpression()), !dbg [[DBG13]] +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 3, metadata [[META7]], metadata !DIExpression()), !dbg [[DBG13]] +; CHECK-NEXT: call void @foo() +; CHECK-NEXT: br label [[JOIN2:%.*]] +; CHECK: else: +; CHECK-NEXT: call void @bar() +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 0, metadata [[META7]], metadata !DIExpression()), !dbg [[DBG13]] +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 1, metadata [[META7]], metadata !DIExpression()), !dbg [[DBG13]] +; CHECK-NEXT: call void @use.i1(i1 false) +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 2, metadata [[META7]], metadata !DIExpression()), !dbg [[DBG13]] +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 3, metadata [[META7]], metadata !DIExpression()), !dbg [[DBG13]] +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 4, metadata [[META7]], metadata !DIExpression()), !dbg [[DBG13]] +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 5, metadata [[META7]], metadata !DIExpression()), !dbg [[DBG13]] +; CHECK-NEXT: call void @bar() +; CHECK-NEXT: br label [[JOIN2]] +; CHECK: join2: +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 6, metadata [[META7]], metadata !DIExpression()), !dbg [[DBG13]] +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 7, metadata [[META7]], metadata !DIExpression()), !dbg [[DBG13]] +; CHECK-NEXT: ret void, !dbg [[DBG13]] +; + br i1 %c, label %if, label %else + +if: + call void @foo() + br label %join + +else: + call void @bar() + br label %join + +join: + %c2 = phi i1 [ true, %if ], [ false, %else ] + call void @llvm.dbg.value(metadata i32 0, metadata !12, metadata !DIExpression()), !dbg !15 + call void @llvm.dbg.value(metadata i32 1, metadata !12, metadata !DIExpression()), !dbg !15 + call void @use.i1(i1 %c2) + call void @llvm.dbg.value(metadata i32 2, metadata !12, metadata !DIExpression()), !dbg !15 + call void @llvm.dbg.value(metadata i32 3, metadata !12, metadata !DIExpression()), !dbg !15 + br i1 %c2, label %if2, label %else2 + +if2: + call void @foo() + br label %join2 + +else2: + call void @llvm.dbg.value(metadata i32 4, metadata !12, metadata !DIExpression()), !dbg !15 + call void @llvm.dbg.value(metadata i32 5, metadata !12, metadata !DIExpression()), !dbg !15 + call void @bar() + br label %join2 + +join2: + call void @llvm.dbg.value(metadata i32 6, metadata !12, metadata !DIExpression()), !dbg !15 + call void @llvm.dbg.value(metadata i32 7, metadata !12, metadata !DIExpression()), !dbg !15 + ret void, !dbg !15 +} + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!3, !4, !5} +!llvm.ident = !{!6} + +!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) +!1 = !DIFile(filename: ".", directory: "/foo") +!2 = !{} +!3 = !{i32 2, !"Dwarf Version", i32 4} +!4 = !{i32 2, !"Debug Info Version", i32 3} +!5 = !{i32 1, !"wchar_size", i32 4} +!6 = !{!"clang"} +!7 = distinct !DISubprogram(name: "test1", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !11) +!8 = !DISubroutineType(types: !9) +!9 = !{!10, !10, !10} +!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!11 = !{!12} +!12 = !DILocalVariable(name: "getdirt", arg: 1, scope: !7, file: !1, line: 1, type: !10) +!15 = !DILocation(line: 1, column: 15, scope: !7) + From 89a832435d786e5ce0668da3720db668beb10e70 Mon Sep 17 00:00:00 2001 From: Guillaume Chatelet Date: Fri, 24 Nov 2023 16:29:29 +0100 Subject: [PATCH 34/35] [libc][cmake] Add missing dependencies for type_traits (#73339) --- libc/src/__support/CPP/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libc/src/__support/CPP/CMakeLists.txt b/libc/src/__support/CPP/CMakeLists.txt index c75fae05fedfcd..10bcebf9b04f61 100644 --- a/libc/src/__support/CPP/CMakeLists.txt +++ b/libc/src/__support/CPP/CMakeLists.txt @@ -148,6 +148,8 @@ add_header_library( type_traits/type_identity.h type_traits/void_t.h DEPENDS + libc.src.__support.macros.attributes + libc.src.__support.macros.config libc.src.__support.macros.properties.float ) From 18a5ca14d16e6e5142fc5527accdfb10c1a22820 Mon Sep 17 00:00:00 2001 From: Egor Zhdan Date: Fri, 24 Nov 2023 16:41:37 +0100 Subject: [PATCH 35/35] [Clang] Fix `-Wdocumentation` warning (NFC) ``` llvm-project/clang/include/clang/AST/OpenMPClause.h:7762:14: warning: parameter 'Modifier' not found in the function declaration [-Wdocumentation] /// \param Modifier The modifier applied to 'order' clause. ^~~~~~~~ llvm-project/clang/include/clang/AST/OpenMPClause.h:7762:14: note: did you mean 'M'? /// \param Modifier The modifier applied to 'order' clause. ``` --- clang/include/clang/AST/OpenMPClause.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/include/clang/AST/OpenMPClause.h b/clang/include/clang/AST/OpenMPClause.h index 549f12e87df597..51155e63dcb8f7 100644 --- a/clang/include/clang/AST/OpenMPClause.h +++ b/clang/include/clang/AST/OpenMPClause.h @@ -7776,10 +7776,10 @@ class OMPOrderClause final : public OMPClause { /// \param MLoc Location of the modifier OMPOrderClause(OpenMPOrderClauseKind A, SourceLocation ALoc, SourceLocation StartLoc, SourceLocation LParenLoc, - SourceLocation EndLoc, OpenMPOrderClauseModifier M, + SourceLocation EndLoc, OpenMPOrderClauseModifier Modifier, SourceLocation MLoc) : OMPClause(llvm::omp::OMPC_order, StartLoc, EndLoc), - LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc), Modifier(M), + LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc), Modifier(Modifier), ModifierKwLoc(MLoc) {} /// Build an empty clause.