Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

aarch64 llvm 14 regression with vectors: Assertion `mutationIsSane(Rule, Query, Mutation) && "legality mutation invalid for match"' failed #56398

Closed
andrewrk opened this issue Jul 6, 2022 · 15 comments · Fixed by llvm/llvm-project-release-prs#25
Assignees
Labels
backend:AArch64 bug Indicates an unexpected problem or unintended behavior regression release:backport release:merged

Comments

@andrewrk
Copy link
Member

andrewrk commented Jul 6, 2022

Does not affect LLVM 13.0.1.
Tested with LLVM 14.0.6. Have not yet confirmed whether it affects trunk.

Reduced LLVM IR:

define internal fastcc i16 @testOneCtzVector.2() {
Entry:
  %0 = call <64 x i16> @llvm.cttz.v64i16(<64 x i16> zeroinitializer, i1 false)
  %1 = trunc <64 x i16> %0 to <64 x i5>
  store <64 x i5> %1, <64 x i5>* null, align 64
  ret i16 0
}

; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
declare <64 x i16> @llvm.cttz.v64i16(<64 x i16>, i1 immarg) #0

attributes #0 = { nofree nosync nounwind readnone speculatable willreturn }

Reproduction:

$ ~/local/llvm14-debug/bin/clang -c reduced.ll -target aarch64-linux-unknown
warning: overriding the module target triple with aarch64-unknown-linux-unknown [-Woverride-module]
clang: /home/andy/Downloads/llvm-project-14/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp:198: llvm::LegalizeActionStep llvm::LegalizeRuleSet::apply(const llvm::LegalityQuery&) const: Assertion `mutationIsSane(Rule, Query, Mutation) && "legality mutation invalid for match"' failed.

Downstream issue: ziglang/zig#12013

Apologies for not catching this during the RC phase.

@andrewrk andrewrk added bug Indicates an unexpected problem or unintended behavior backend:AArch64 regression labels Jul 6, 2022
@andrewrk andrewrk added this to the LLVM 15.0.0 Release milestone Jul 6, 2022
@llvmbot
Copy link
Member

llvmbot commented Jul 6, 2022

@llvm/issue-subscribers-bug

@llvmbot
Copy link
Member

llvmbot commented Jul 6, 2022

@llvm/issue-subscribers-backend-aarch64

@DavidSpickett
Copy link
Collaborator

DavidSpickett commented Jul 6, 2022

This starts from:

$ git bisect good
ebc17a0d68208a967fe8e13e1874874228dda622 is the first bad commit
commit ebc17a0d68208a967fe8e13e1874874228dda622
Author: Matt Arsenault <Matthew.Arsenault@amd.com>
Date:   Tue Jul 27 11:08:06 2021 -0400

    GlobalISel: Scalarize unaligned vector stores

    This has the same problems and limitations as the load path.

ebc17a0

@arsenm

@aemerson
Copy link
Contributor

Missing vector legalization rules for G_CTTZ and we end up trying to use a scalar rule instead.

@aemerson
Copy link
Contributor

Thanks for the bug report. Should be fixed in 9cc1dd2

@andrewrk
Copy link
Member Author

Thanks for the fix!

Re-opening since this commit has not yet landed in the release/15.x branch. cc @tstellar

@andrewrk andrewrk reopened this Jul 27, 2022
@nikic
Copy link
Contributor

nikic commented Jul 27, 2022

/cherry-pick 9cc1dd2

@llvmbot
Copy link
Member

llvmbot commented Jul 27, 2022

/branch llvm/llvm-project-release-prs/issue56398

@nikic
Copy link
Contributor

nikic commented Jul 27, 2022

@tstellar https://github.com/llvm/llvm-project/runs/7537547137?check_suite_focus=true

Cmd('git') failed due to: exit code(128)
  cmdline: git fetch https://github.com/llvm/llvm-project issue56398:issue56398
  stderr: 'fatal: couldn't find remote ref issue56398'

There's two problems here:

  1. We should not try to mirror the branch if it's already on the llvm-project-release-prs repo
  2. We currently assume the repo name is llvm-project. (Maybe this is fine generally, just fails for llvm-project-release-prs in particular)

@tstellar
Copy link
Collaborator

/branch llvm/llvm-project-release-prs/issue56398

@tstellar
Copy link
Collaborator

@tstellar https://github.com/llvm/llvm-project/runs/7537547137?check_suite_focus=true

Cmd('git') failed due to: exit code(128)
  cmdline: git fetch https://github.com/llvm/llvm-project issue56398:issue56398
  stderr: 'fatal: couldn't find remote ref issue56398'

There's two problems here:

1. We should not try to mirror the branch if it's already on the llvm-project-release-prs repo

OK, I'll make this change.

2. We currently assume the repo name is llvm-project. (Maybe this is fine generally, just fails for  llvm-project-release-prs in particular)

I fixed this issue.

@tstellar tstellar moved this to Needs Triage in LLVM Release Status Jul 27, 2022
@tstellar tstellar moved this from Needs Triage to Needs Review in LLVM Release Status Jul 27, 2022
@nikic
Copy link
Contributor

nikic commented Jul 27, 2022

Thanks! Unfortunately we get a new error now (https://github.com/llvm/llvm-project/runs/7549380969?check_suite_focus=true):

Cmd('git') failed due to: exit code(128)
  cmdline: git push --force https://***@github.com/llvm/llvm-project-release-prs issue56398:llvm-issue56398
  stderr: 'remote: Permission to llvm/llvm-project-release-prs.git denied to github-actions[bot].

@tstellar
Copy link
Collaborator

/branch llvm/llvm-project-release-prs/issue56398

@llvmbot
Copy link
Member

llvmbot commented Jul 28, 2022

/pull-request llvm/llvm-project-release-prs#25

@tstellar
Copy link
Collaborator

Thanks! Unfortunately we get a new error now (https://github.com/llvm/llvm-project/runs/7549380969?check_suite_focus=true):

Cmd('git') failed due to: exit code(128)
  cmdline: git push --force https://***@github.com/llvm/llvm-project-release-prs issue56398:llvm-issue56398
  stderr: 'remote: Permission to llvm/llvm-project-release-prs.git denied to github-actions[bot].

I fixed this in b1dace6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:AArch64 bug Indicates an unexpected problem or unintended behavior regression release:backport release:merged
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

8 participants