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 'icmp sle' -> 'icmp slt' w/ vectors #43075

Closed
nunoplopes opened this issue Oct 20, 2019 · 6 comments
Closed

Incorrect 'icmp sle' -> 'icmp slt' w/ vectors #43075

nunoplopes opened this issue Oct 20, 2019 · 6 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla miscompilation

Comments

@nunoplopes
Copy link
Member

Bugzilla Link 43730
Resolution FIXED
Resolved on Oct 29, 2019 08:14
Version trunk
OS All
CC @LebedevRI,@RKSimon,@regehr,@rotateright

Extended Description

This transformation exposed in Transforms/InstCombine/icmp-vec.ll is incorrect. The issue is that "INT_MIN <= undef" is not the same as "INT_MIN < undef".

define <2 x i1> @​#27756 _2(<2 x i8> %a) {
%cmp = icmp sle <2 x i8> %a, { undef, 0 }
ret <2 x i1> %cmp
}
=>
define <2 x i1> @​#27756 _2(<2 x i8> %a) {
%cmp = icmp slt <2 x i8> %a, { undef, 1 }
ret <2 x i1> %cmp
}
Transformation doesn't verify!
ERROR: Value mismatch

Example:
<2 x i8> %a = < #x80 (128, -128), #x80 (128, -128) >

Source:
<2 x i1> %cmp = < #x1 (1), #x1 (1) >

Target:
<2 x i1> %cmp = < #x0 (0), #x1 (1) >
Source value: < #x1 (1), #x1 (1) >
Target value: < #x0 (0), #x1 (1) >

@nunoplopes
Copy link
Member Author

assigned to @rotateright

@rotateright
Copy link
Contributor

This bug was probably recently introduced via an improvement for icmp canonicalization. I'll propose a fix.

@rotateright
Copy link
Contributor

@rotateright
Copy link
Contributor

Should be fixed by replacing undefs with safe constants:
https://reviews.llvm.org/rGa22282be54b3

@rotateright
Copy link
Contributor

*** Bug llvm/llvm-bugzilla-archive#43731 has been marked as a duplicate of this bug. ***

@rotateright
Copy link
Contributor

mentioned in issue llvm/llvm-bugzilla-archive#43731

@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
bugzilla Issues migrated from bugzilla miscompilation
Projects
None yet
Development

No branches or pull requests

2 participants