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

Incorrect code generation of conditional compares for AArch64 #24833

Closed
kbeyls opened this issue Aug 14, 2015 · 5 comments
Closed

Incorrect code generation of conditional compares for AArch64 #24833

kbeyls opened this issue Aug 14, 2015 · 5 comments
Assignees
Labels
backend:AArch64 bugzilla Issues migrated from bugzilla

Comments

@kbeyls
Copy link
Collaborator

kbeyls commented Aug 14, 2015

Bugzilla Link 24459
Resolution FIXED
Resolved on Aug 20, 2015 18:34
Version trunk
OS All
Attachments reduced test case, Assembly produced by r242435 (correct), Assembly produced by r242436 (incorrect)
CC @MatzeB

Extended Description

It seems that http://llvm.org/viewvc/llvm-project?view=revision&revision=242436 introduced a correctness regression.
The attached reduced test case (still not tiny though) shows that at optimization level -O1, this code gets miscompiled, while it still was getting compiled correctly by clang r242436.

$ ./llvm.org/cmake-build-r242435/bin/clang ./reproducer/aarch64_tree_tests_reduce.c -S -O1 -o ./reproducer/t.242435.s;
$ ./llvm.org/cmake-build-r242436/bin/clang ./reproducer/aarch64_tree_tests_reduce.c -S -O1 -o ./reproducer/t.242436.s;
$ ./llvm.org/cmake-build-r242435/bin/clang ./reproducer/aarch64_tree_tests_reduce.c -O1 -o ./reproducer/t.242435.exe;
$ ./llvm.org/cmake-build-r242436/bin/clang ./reproducer/aarch64_tree_tests_reduce.c -O1 -o ./reproducer/t.242436.exe;
$ ./reproducer/t.242435.exe
$ ./reproducer/t.242436.exe
Expected: 0000000000000000 Got: 0000000000000000

@kbeyls
Copy link
Collaborator Author

kbeyls commented Aug 14, 2015

assigned to @MatzeB

@MatzeB
Copy link
Contributor

MatzeB commented Aug 19, 2015

I tried reproducing this on llvm r245350 (and r245348) and cannot reproduce this on a aarch64-apple-ios target.

Could you provide the actual assembly for r242436 case instead of an executable?

@kbeyls
Copy link
Collaborator Author

kbeyls commented Aug 19, 2015

Assembly produced by r242436 (incorrect)
Apologies, I'm now attaching the assembly code I see coming out of r242436.

@kbeyls
Copy link
Collaborator Author

kbeyls commented Aug 19, 2015

With the following command line options, cross-compiling from an x86 linux host, I can reproduce the same ccmp sequences that seem to be incorrect:

$ clang -target aarch64 -mcpu=generic -O1 aarch64_tree_tests_reduce.c -S
$ clang -target arm64-apple-ios -O1 aarch64_tree_tests_reduce.c -S

The -O1 optimization level is important to reproduce the problem: it does not manifest at other optimization levels.

I could reproduce this assembly from both r242436 and r245350.

@MatzeB
Copy link
Contributor

MatzeB commented Aug 21, 2015

Fixed in r245641.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:AArch64 bugzilla Issues migrated from bugzilla
Projects
None yet
Development

No branches or pull requests

2 participants