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

Instcombine: incorrect transformation 'x > (x & undef)' -> 'x > undef' #43728

Closed
nunoplopes opened this issue Dec 26, 2019 · 4 comments
Closed
Labels
bugzilla Issues migrated from bugzilla miscompilation

Comments

@nunoplopes
Copy link
Member

Bugzilla Link 44383
Resolution FIXED
Resolved on Oct 23, 2020 18:33
Version trunk
OS All
Blocks #47292
CC @LebedevRI,@RKSimon,@regehr,@rotateright
Fixed by commit(s) rG164058274364

Extended Description

The following transformation in Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-sgt-to-icmp-sgt.ll is incorrect:

define <3 x i1> @​p3_vec_splat_undef() {
%x = call <3 x i8> @​gen3x8()
%tmp0 = and <3 x i8> %x, { 3, undef, 3 }
%ret = icmp sgt <3 x i8> %x, %tmp0
ret <3 x i1> %ret
}
=>
define <3 x i1> @​p3_vec_splat_undef() {

%x = call <3 x i8> @​gen3x8()
%1 = icmp sgt <3 x i8> %x, { 3, undef, 3 }
ret <3 x i1> %1
}

Transformation doesn't verify!
ERROR: Value mismatch

Example:

Source:
<3 x i8> %x = < poison, #x00 (0), poison >
<3 x i8> %tmp0 = < poison, #x00 (0), poison >
<3 x i1> %ret = < poison, #x0 (0), poison >

Target:
<3 x i8> %x = < poison, #x00 (0), poison >
<3 x i1> %1 = < poison, #x1 (1), poison >
Source value: < poison, #x0 (0), poison >
Target value: < poison, #x1 (1), poison >

The transformation does 'x > (x & undef)' -> 'x > undef'.
Take x=0, undef=-1, and we get '0 > 0' -> '0 > -1'.

@rotateright
Copy link
Contributor

@RKSimon
Copy link
Collaborator

RKSimon commented Feb 8, 2020

https://reviews.llvm.org/D72101

@​nlopes @​spatel This landed at rG164058274364 - resolve this?

@rotateright
Copy link
Contributor

Forgot to mark this bug as fixed with:
https://reviews.llvm.org/rG164058274364670c8b59055b4689ae7e1720268e

@aqjune
Copy link
Contributor

aqjune commented Nov 27, 2021

mentioned in issue #47292

@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

4 participants