Skip to content

[SimplifyCFG] Handle trunc condition in foldBranchToCommonDest. #135490

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 13, 2025

Conversation

andjo403
Copy link
Contributor

Noticed regressions due to this missing fold when trying to add the fold icmp ne (and X, 1), 0 --> trunc X to i1

proof: https://alive2.llvm.org/ce/z/v32Aof

@llvmbot
Copy link
Member

llvmbot commented Apr 12, 2025

@llvm/pr-subscribers-llvm-transforms

Author: Andreas Jonson (andjo403)

Changes

Noticed regressions due to this missing fold when trying to add the fold icmp ne (and X, 1), 0 --> trunc X to i1

proof: https://alive2.llvm.org/ce/z/v32Aof


Full diff: https://github.com/llvm/llvm-project/pull/135490.diff

2 Files Affected:

  • (modified) llvm/lib/Transforms/Utils/SimplifyCFG.cpp (+1-3)
  • (modified) llvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest.ll (+2-3)
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index eac7e7c209c95..7f53aa7d4f73d 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -4087,9 +4087,7 @@ bool llvm::foldBranchToCommonDest(BranchInst *BI, DomTreeUpdater *DTU,
 
   Instruction *Cond = dyn_cast<Instruction>(BI->getCondition());
 
-  if (!Cond ||
-      (!isa<CmpInst>(Cond) && !isa<BinaryOperator>(Cond) &&
-       !isa<SelectInst>(Cond)) ||
+  if (!Cond || !isa<CmpInst, BinaryOperator, SelectInst, TruncInst>(Cond) ||
       Cond->getParent() != BB || !Cond->hasOneUse())
     return false;
 
diff --git a/llvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest.ll b/llvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest.ll
index 37f48a9a7e03a..7b88ec338cf5e 100644
--- a/llvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest.ll
+++ b/llvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest.ll
@@ -88,10 +88,9 @@ define void @one_pred_trunc_cond(i8 %v0, i8 %v1) {
 ; CHECK-LABEL: @one_pred_trunc_cond(
 ; CHECK-NEXT:  pred:
 ; CHECK-NEXT:    [[C0:%.*]] = icmp eq i8 [[V0:%.*]], 0
-; CHECK-NEXT:    br i1 [[C0]], label [[DISPATCH:%.*]], label [[FINAL_RIGHT:%.*]]
-; CHECK:       dispatch:
 ; CHECK-NEXT:    [[C1:%.*]] = trunc i8 [[V1:%.*]] to i1
-; CHECK-NEXT:    br i1 [[C1]], label [[FINAL_LEFT:%.*]], label [[FINAL_RIGHT]]
+; CHECK-NEXT:    [[OR_COND:%.*]] = select i1 [[C0]], i1 [[C1]], i1 false
+; CHECK-NEXT:    br i1 [[OR_COND]], label [[FINAL_LEFT:%.*]], label [[FINAL_RIGHT:%.*]]
 ; CHECK:       common.ret:
 ; CHECK-NEXT:    ret void
 ; CHECK:       final_left:

@andjo403 andjo403 requested review from nikic, fhahn and dtcxzyw April 12, 2025 10:43
@nikic
Copy link
Contributor

nikic commented Apr 12, 2025

There are test failures.

@andjo403 andjo403 force-pushed the truncInSimplifyCfg branch from f2bf8e2 to ca29cef Compare April 12, 2025 15:49
@andjo403
Copy link
Contributor Author

sorry about that the tests are fixed now

Copy link
Member

@dtcxzyw dtcxzyw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG

@andjo403 andjo403 merged commit ed43207 into llvm:main Apr 13, 2025
11 checks passed
@andjo403 andjo403 deleted the truncInSimplifyCfg branch April 13, 2025 12:06
@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 13, 2025

LLVM Buildbot has detected a new failure on builder sanitizer-aarch64-linux-bootstrap-hwasan running on sanitizer-buildbot12 while building llvm at step 2 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/55/builds/9813

Here is the relevant piece of the build log for the reference
Step 2 (annotate) failure: 'python ../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py' (failure)
...
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/ld.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 84676 tests, 72 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.
FAIL: LLVM :: tools/llvm-reduce/flaky-interestingness.ll (81743 of 84676)
******************** TEST 'LLVM :: tools/llvm-reduce/flaky-interestingness.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
rm -f /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/test/tools/llvm-reduce/Output/flaky-interestingness.ll.tmp # RUN: at line 2
+ rm -f /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/test/tools/llvm-reduce/Output/flaky-interestingness.ll.tmp
llvm-reduce -j=1 --delta-passes=instructions --test "/usr/bin/python3" --test-arg /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/tools/llvm-reduce/Inputs/flaky-test.py --test-arg /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/test/tools/llvm-reduce/Output/flaky-interestingness.ll.tmp /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/tools/llvm-reduce/flaky-interestingness.ll -o /dev/null 2>&1 | /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/FileCheck /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/tools/llvm-reduce/flaky-interestingness.ll # RUN: at line 3
+ /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/FileCheck /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/tools/llvm-reduce/flaky-interestingness.ll
+ llvm-reduce -j=1 --delta-passes=instructions --test /usr/bin/python3 --test-arg /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/tools/llvm-reduce/Inputs/flaky-test.py --test-arg /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/test/tools/llvm-reduce/Output/flaky-interestingness.ll.tmp /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/tools/llvm-reduce/flaky-interestingness.ll -o /dev/null
rm -f /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/test/tools/llvm-reduce/Output/flaky-interestingness.ll.tmp # RUN: at line 6
+ rm -f /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/test/tools/llvm-reduce/Output/flaky-interestingness.ll.tmp
llvm-reduce -j=1 -skip-verify-interesting-after-counting-chunks --delta-passes=instructions --test "/usr/bin/python3" --test-arg /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/tools/llvm-reduce/Inputs/flaky-test.py --test-arg /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/test/tools/llvm-reduce/Output/flaky-interestingness.ll.tmp /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/tools/llvm-reduce/flaky-interestingness.ll -o /dev/null 2>&1 | /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/FileCheck --allow-empty -check-prefix=QUIET /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/tools/llvm-reduce/flaky-interestingness.ll # RUN: at line 7
+ llvm-reduce -j=1 -skip-verify-interesting-after-counting-chunks --delta-passes=instructions --test /usr/bin/python3 --test-arg /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/tools/llvm-reduce/Inputs/flaky-test.py --test-arg /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/test/tools/llvm-reduce/Output/flaky-interestingness.ll.tmp /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/tools/llvm-reduce/flaky-interestingness.ll -o /dev/null
+ /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/FileCheck --allow-empty -check-prefix=QUIET /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/tools/llvm-reduce/flaky-interestingness.ll
/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/tools/llvm-reduce/flaky-interestingness.ll:15:14: error: QUIET-NOT: excluded string found in input
; QUIET-NOT: error
             ^
<stdin>:65:14: note: found here
llvm-reduce: error: running interesting-ness test: Segmentation fault
             ^~~~~

Input file: <stdin>
Check file: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/tools/llvm-reduce/flaky-interestingness.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
        .
        .
        .
       60:  pathlib.Path(sys.argv[1]).touch(exist_ok=False) 
       61:  File "/usr/lib/python3.12/pathlib.py", line 1305, in touch 
       62:  fd = os.open(self, flags, mode) 
       63:  ^^^^^^^^^^^^^^^^^^^^^^^^^^ 
       64: FileExistsError: [Errno 17] File exists: '/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/test/tools/llvm-reduce/Output/flaky-interestingness.ll.tmp' 
       65: llvm-reduce: error: running interesting-ness test: Segmentation fault 
Step 14 (stage3/hwasan check) failure: stage3/hwasan check (failure)
...
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/ld.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 84676 tests, 72 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.
FAIL: LLVM :: tools/llvm-reduce/flaky-interestingness.ll (81743 of 84676)
******************** TEST 'LLVM :: tools/llvm-reduce/flaky-interestingness.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
rm -f /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/test/tools/llvm-reduce/Output/flaky-interestingness.ll.tmp # RUN: at line 2
+ rm -f /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/test/tools/llvm-reduce/Output/flaky-interestingness.ll.tmp
llvm-reduce -j=1 --delta-passes=instructions --test "/usr/bin/python3" --test-arg /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/tools/llvm-reduce/Inputs/flaky-test.py --test-arg /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/test/tools/llvm-reduce/Output/flaky-interestingness.ll.tmp /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/tools/llvm-reduce/flaky-interestingness.ll -o /dev/null 2>&1 | /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/FileCheck /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/tools/llvm-reduce/flaky-interestingness.ll # RUN: at line 3
+ /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/FileCheck /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/tools/llvm-reduce/flaky-interestingness.ll
+ llvm-reduce -j=1 --delta-passes=instructions --test /usr/bin/python3 --test-arg /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/tools/llvm-reduce/Inputs/flaky-test.py --test-arg /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/test/tools/llvm-reduce/Output/flaky-interestingness.ll.tmp /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/tools/llvm-reduce/flaky-interestingness.ll -o /dev/null
rm -f /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/test/tools/llvm-reduce/Output/flaky-interestingness.ll.tmp # RUN: at line 6
+ rm -f /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/test/tools/llvm-reduce/Output/flaky-interestingness.ll.tmp
llvm-reduce -j=1 -skip-verify-interesting-after-counting-chunks --delta-passes=instructions --test "/usr/bin/python3" --test-arg /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/tools/llvm-reduce/Inputs/flaky-test.py --test-arg /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/test/tools/llvm-reduce/Output/flaky-interestingness.ll.tmp /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/tools/llvm-reduce/flaky-interestingness.ll -o /dev/null 2>&1 | /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/FileCheck --allow-empty -check-prefix=QUIET /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/tools/llvm-reduce/flaky-interestingness.ll # RUN: at line 7
+ llvm-reduce -j=1 -skip-verify-interesting-after-counting-chunks --delta-passes=instructions --test /usr/bin/python3 --test-arg /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/tools/llvm-reduce/Inputs/flaky-test.py --test-arg /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/test/tools/llvm-reduce/Output/flaky-interestingness.ll.tmp /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/tools/llvm-reduce/flaky-interestingness.ll -o /dev/null
+ /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/FileCheck --allow-empty -check-prefix=QUIET /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/tools/llvm-reduce/flaky-interestingness.ll
/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/tools/llvm-reduce/flaky-interestingness.ll:15:14: error: QUIET-NOT: excluded string found in input
; QUIET-NOT: error
             ^
<stdin>:65:14: note: found here
llvm-reduce: error: running interesting-ness test: Segmentation fault
             ^~~~~

Input file: <stdin>
Check file: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/tools/llvm-reduce/flaky-interestingness.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
        .
        .
        .
       60:  pathlib.Path(sys.argv[1]).touch(exist_ok=False) 
       61:  File "/usr/lib/python3.12/pathlib.py", line 1305, in touch 
       62:  fd = os.open(self, flags, mode) 
       63:  ^^^^^^^^^^^^^^^^^^^^^^^^^^ 
       64: FileExistsError: [Errno 17] File exists: '/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/test/tools/llvm-reduce/Output/flaky-interestingness.ll.tmp' 
       65: llvm-reduce: error: running interesting-ness test: Segmentation fault 

@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 13, 2025

LLVM Buildbot has detected a new failure on builder sanitizer-aarch64-linux-bootstrap-msan running on sanitizer-buildbot9 while building llvm at step 2 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/94/builds/6162

Here is the relevant piece of the build log for the reference
Step 2 (annotate) failure: 'python ../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py' (failure)
...
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld.lld: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/ld.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 87690 tests, 72 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70..
FAIL: LLVM :: Transforms/LoopVectorize/SystemZ/pr47665.ll (69604 of 87690)
******************** TEST 'LLVM :: Transforms/LoopVectorize/SystemZ/pr47665.ll' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/opt -passes=loop-vectorize -mtriple=s390x -mcpu=z14 -S /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/LoopVectorize/SystemZ/pr47665.ll | /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/FileCheck /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/LoopVectorize/SystemZ/pr47665.ll # RUN: at line 2
+ /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/FileCheck /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/LoopVectorize/SystemZ/pr47665.ll
+ /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/opt -passes=loop-vectorize -mtriple=s390x -mcpu=z14 -S /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/LoopVectorize/SystemZ/pr47665.ll
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/opt -passes=loop-vectorize -mtriple=s390x -mcpu=z14 -S /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/LoopVectorize/SystemZ/pr47665.ll
1.	Running pass "function(loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>)" on module "/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/LoopVectorize/SystemZ/pr47665.ll"
2.	Running pass "loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>" on function "test"
 #0 0x0000aaaaaf16bea4 ___interceptor_backtrace /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/msan/../sanitizer_common/sanitizer_common_interceptors.inc:4513:13
 #1 0x0000aaaaaf246bec llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Support/Unix/Signals.inc:808:7
 #2 0x0000aaaaaf2415e8 llvm::sys::RunSignalHandlers() /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Support/Signals.cpp:106:18
 #3 0x0000aaaaaf247d84 SignalHandler(int, siginfo_t*, void*) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Support/Unix/Signals.inc:0:3
 #4 0x0000aaaaaf19dfd0 IsInInterceptorScope /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/msan/msan_interceptors.cpp:77:10
 #5 0x0000aaaaaf19dfd0 SignalAction(int, void*, void*) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/msan/msan_interceptors.cpp:1137:3
 #6 0x0000fffff7ffb8f8 (linux-vdso.so.1+0x8f8)
 #7 0x0000fffff7a87608 (/lib/aarch64-linux-gnu/libc.so.6+0x87608)
 #8 0x0000fffff7a3cb3c raise (/lib/aarch64-linux-gnu/libc.so.6+0x3cb3c)
 #9 0x0000fffff7a27e00 abort (/lib/aarch64-linux-gnu/libc.so.6+0x27e00)
#10 0x0000aaaaaf12bb9c __sanitizer::Atexit(void (*)()) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp:168:10
#11 0x0000aaaaaf1299c0 __sanitizer::Die() /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_termination.cpp:52:5
#12 0x0000aaaaaf13f2dc __msan_warning_with_origin /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/msan/msan.cpp:409:0
#13 0x0000aaaab2a2edd0 getOperand /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/VPlanValue.h:239:5
#14 0x0000aaaab2a2edd0 simplifyRecipe /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp:999:11
#15 0x0000aaaab2a2edd0 llvm::VPlanTransforms::simplifyRecipes(llvm::VPlan&, llvm::Type&) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp:1029:7
#16 0x0000aaaab2a3a1d0 runPass<llvm::Type &> /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/VPlanTransforms.h:0:5
#17 0x0000aaaab2a3a1d0 llvm::VPlanTransforms::optimize(llvm::VPlan&) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp:1753:3
#18 0x0000aaaab28eaa60 llvm::LoopVectorizationPlanner::buildVPlansWithVPRecipes(llvm::ElementCount, llvm::ElementCount) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:0:7
#19 0x0000aaaab28e9cb8 llvm::LoopVectorizationPlanner::plan(llvm::ElementCount, unsigned int) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:7444:3
#20 0x0000aaaab291e09c llvm::LoopVectorizePass::processLoop(llvm::Loop*) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:10997:3
#21 0x0000aaaab292eab8 llvm::LoopVectorizePass::runImpl(llvm::Function&) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:11295:27
#22 0x0000aaaab292fe50 llvm::LoopVectorizePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:11333:15
#23 0x0000aaaaaf7ae944 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/PassManagerImpl.h:85:8
#24 0x0000aaaaaf7bbb38 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/IR/PassManager.cpp:0:38
Step 11 (stage2/msan check) failure: stage2/msan check (failure)
...
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld.lld: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/ld.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 87690 tests, 72 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70..
FAIL: LLVM :: Transforms/LoopVectorize/SystemZ/pr47665.ll (69604 of 87690)
******************** TEST 'LLVM :: Transforms/LoopVectorize/SystemZ/pr47665.ll' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/opt -passes=loop-vectorize -mtriple=s390x -mcpu=z14 -S /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/LoopVectorize/SystemZ/pr47665.ll | /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/FileCheck /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/LoopVectorize/SystemZ/pr47665.ll # RUN: at line 2
+ /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/FileCheck /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/LoopVectorize/SystemZ/pr47665.ll
+ /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/opt -passes=loop-vectorize -mtriple=s390x -mcpu=z14 -S /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/LoopVectorize/SystemZ/pr47665.ll
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/opt -passes=loop-vectorize -mtriple=s390x -mcpu=z14 -S /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/LoopVectorize/SystemZ/pr47665.ll
1.	Running pass "function(loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>)" on module "/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/LoopVectorize/SystemZ/pr47665.ll"
2.	Running pass "loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>" on function "test"
 #0 0x0000aaaaaf16bea4 ___interceptor_backtrace /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/msan/../sanitizer_common/sanitizer_common_interceptors.inc:4513:13
 #1 0x0000aaaaaf246bec llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Support/Unix/Signals.inc:808:7
 #2 0x0000aaaaaf2415e8 llvm::sys::RunSignalHandlers() /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Support/Signals.cpp:106:18
 #3 0x0000aaaaaf247d84 SignalHandler(int, siginfo_t*, void*) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Support/Unix/Signals.inc:0:3
 #4 0x0000aaaaaf19dfd0 IsInInterceptorScope /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/msan/msan_interceptors.cpp:77:10
 #5 0x0000aaaaaf19dfd0 SignalAction(int, void*, void*) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/msan/msan_interceptors.cpp:1137:3
 #6 0x0000fffff7ffb8f8 (linux-vdso.so.1+0x8f8)
 #7 0x0000fffff7a87608 (/lib/aarch64-linux-gnu/libc.so.6+0x87608)
 #8 0x0000fffff7a3cb3c raise (/lib/aarch64-linux-gnu/libc.so.6+0x3cb3c)
 #9 0x0000fffff7a27e00 abort (/lib/aarch64-linux-gnu/libc.so.6+0x27e00)
#10 0x0000aaaaaf12bb9c __sanitizer::Atexit(void (*)()) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp:168:10
#11 0x0000aaaaaf1299c0 __sanitizer::Die() /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_termination.cpp:52:5
#12 0x0000aaaaaf13f2dc __msan_warning_with_origin /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/msan/msan.cpp:409:0
#13 0x0000aaaab2a2edd0 getOperand /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/VPlanValue.h:239:5
#14 0x0000aaaab2a2edd0 simplifyRecipe /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp:999:11
#15 0x0000aaaab2a2edd0 llvm::VPlanTransforms::simplifyRecipes(llvm::VPlan&, llvm::Type&) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp:1029:7
#16 0x0000aaaab2a3a1d0 runPass<llvm::Type &> /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/VPlanTransforms.h:0:5
#17 0x0000aaaab2a3a1d0 llvm::VPlanTransforms::optimize(llvm::VPlan&) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp:1753:3
#18 0x0000aaaab28eaa60 llvm::LoopVectorizationPlanner::buildVPlansWithVPRecipes(llvm::ElementCount, llvm::ElementCount) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:0:7
#19 0x0000aaaab28e9cb8 llvm::LoopVectorizationPlanner::plan(llvm::ElementCount, unsigned int) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:7444:3
#20 0x0000aaaab291e09c llvm::LoopVectorizePass::processLoop(llvm::Loop*) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:10997:3
#21 0x0000aaaab292eab8 llvm::LoopVectorizePass::runImpl(llvm::Function&) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:11295:27
#22 0x0000aaaab292fe50 llvm::LoopVectorizePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:11333:15
#23 0x0000aaaaaf7ae944 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/PassManagerImpl.h:85:8
#24 0x0000aaaaaf7bbb38 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/IR/PassManager.cpp:0:38
Step 16 (stage2/msan_track_origins check) failure: stage2/msan_track_origins check (failure)
...
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld.lld: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/ld.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 87690 tests, 72 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70..
FAIL: LLVM :: Transforms/LoopVectorize/SystemZ/pr47665.ll (69574 of 87690)
******************** TEST 'LLVM :: Transforms/LoopVectorize/SystemZ/pr47665.ll' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/opt -passes=loop-vectorize -mtriple=s390x -mcpu=z14 -S /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/LoopVectorize/SystemZ/pr47665.ll | /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/FileCheck /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/LoopVectorize/SystemZ/pr47665.ll # RUN: at line 2
+ /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/FileCheck /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/LoopVectorize/SystemZ/pr47665.ll
+ /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/opt -passes=loop-vectorize -mtriple=s390x -mcpu=z14 -S /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/LoopVectorize/SystemZ/pr47665.ll
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/opt -passes=loop-vectorize -mtriple=s390x -mcpu=z14 -S /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/LoopVectorize/SystemZ/pr47665.ll
1.	Running pass "function(loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>)" on module "/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/LoopVectorize/SystemZ/pr47665.ll"
2.	Running pass "loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>" on function "test"
 #0 0x0000aaaaaf53d9a4 ___interceptor_backtrace /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/msan/../sanitizer_common/sanitizer_common_interceptors.inc:4513:13
 #1 0x0000aaaaaf657f00 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Support/Unix/Signals.inc:0:13
 #2 0x0000aaaaaf650728 llvm::sys::RunSignalHandlers() /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Support/Signals.cpp:106:18
 #3 0x0000aaaaaf659724 SignalHandler(int, siginfo_t*, void*) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Support/Unix/Signals.inc:0:3
 #4 0x0000aaaaaf56fad0 IsInInterceptorScope /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/msan/msan_interceptors.cpp:77:10
 #5 0x0000aaaaaf56fad0 SignalAction(int, void*, void*) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/msan/msan_interceptors.cpp:1137:3
 #6 0x0000fffff7ffb8f8 (linux-vdso.so.1+0x8f8)
 #7 0x0000fffff79e7608 (/lib/aarch64-linux-gnu/libc.so.6+0x87608)
 #8 0x0000fffff799cb3c raise (/lib/aarch64-linux-gnu/libc.so.6+0x3cb3c)
 #9 0x0000fffff7987e00 abort (/lib/aarch64-linux-gnu/libc.so.6+0x27e00)
#10 0x0000aaaaaf4fd69c __sanitizer::Atexit(void (*)()) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp:168:10
#11 0x0000aaaaaf4fb4c0 __sanitizer::Die() /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_termination.cpp:52:5
#12 0x0000aaaaaf510e74 __msan_init /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/msan/msan.cpp:444:0
#13 0x0000aaaab44458fc simplifyRecipe /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp:998:27
#14 0x0000aaaab44458fc llvm::VPlanTransforms::simplifyRecipes(llvm::VPlan&, llvm::Type&) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp:1029:7
#15 0x0000aaaab4454da0 runPass<llvm::Type &> /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/VPlanTransforms.h:0:5
#16 0x0000aaaab4454da0 llvm::VPlanTransforms::optimize(llvm::VPlan&) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp:1753:3
#17 0x0000aaaab4283500 llvm::LoopVectorizationPlanner::buildVPlansWithVPRecipes(llvm::ElementCount, llvm::ElementCount) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:0:7
#18 0x0000aaaab4282174 llvm::LoopVectorizationPlanner::plan(llvm::ElementCount, unsigned int) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:7444:3
#19 0x0000aaaab42c8b78 llvm::LoopVectorizePass::processLoop(llvm::Loop*) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:10997:3
#20 0x0000aaaab42e03f0 llvm::LoopVectorizePass::runImpl(llvm::Function&) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:11295:27
#21 0x0000aaaab42e1d88 llvm::LoopVectorizePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:11333:15
#22 0x0000aaaaafdf30cc llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/PassManagerImpl.h:85:8
#23 0x0000aaaaafe05614 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/IR/PassManager.cpp:0:38
#24 0x0000aaaaafdee584 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/PassManagerImpl.h:85:8

@nikic
Copy link
Contributor

nikic commented Apr 13, 2025

@andjo403
Copy link
Contributor Author

So shall I revert it? do I understand correct that it is not the optimization that is slow but it generates a slower binary

@nikic
Copy link
Contributor

nikic commented Apr 13, 2025

So shall I revert it? do I understand correct that it is not the optimization that is slow but it generates a slower binary

Yes, it generates a slower binary, at least in terms of instructions retired. I think part of the problem here may be that a lot of targets seem to treat all truncates as free? https://llvm.godbolt.org/z/49Tq8qEqe So they don't count towards the bonus inst threshold. A trunc i1 without nuw should have the same cost as an and 1, I think.

@dtcxzyw
Copy link
Member

dtcxzyw commented Apr 14, 2025

So shall I revert it? do I understand correct that it is not the optimization that is slow but it generates a slower binary

Yes, it generates a slower binary, at least in terms of instructions retired. I think part of the problem here may be that a lot of targets seem to treat all truncates as free? https://llvm.godbolt.org/z/49Tq8qEqe So they don't count towards the bonus inst threshold. A trunc i1 without nuw should have the same cost as an and 1, I think.

I thought this patch would reduce the number of branches. Perhaps we can adjust foldBranchToCommonDest to only handle trunc nuw %x to i1.

@andjo403
Copy link
Contributor Author

The condition is not included in the cost comparison see:

// Don't check the branch condition comparison itself.
if (&I == Cond)
continue;

so I do not know if there will be some change to execution time except that less branches will be removed.
but also will there not be more instructions retired by design and the hope is that they are cheaper then a branch.

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

Successfully merging this pull request may close these issues.

5 participants