LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 45455 - Invalid undef splat in instcombine
Summary: Invalid undef splat in instcombine
Status: RESOLVED DUPLICATE of bug 45955
Alias: None
Product: libraries
Classification: Unclassified
Component: Scalar Optimizations (show other bugs)
Version: trunk
Hardware: All All
: P normal
Assignee: Unassigned LLVM Bugs
URL:
Keywords: miscompilation
Depends on:
Blocks:
 
Reported: 2020-04-07 01:29 PDT by Nuno Lopes
Modified: 2020-05-20 07:26 PDT (History)
5 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nuno Lopes 2020-04-07 01:29:38 PDT
Test: Transforms/InstCombine/unfold-masked-merge-with-const-mask-vector.ll

define <3 x i4> @splat_undef(<3 x i4> %x, <3 x i4> %y) {
  %n0 = xor <3 x i4> %x, %y
  %n1 = and <3 x i4> %n0, { 14, undef, 14 }
  %r = xor <3 x i4> %n1, %y
  ret <3 x i4> %r
}
=>
define <3 x i4> @splat_undef(<3 x i4> %x, <3 x i4> %y) {
  %1 = and <3 x i4> %x, { 14, undef, 14 }
  %2 = and <3 x i4> %y, { 1, undef, 1 }
  %r = or <3 x i4> %1, %2
  ret <3 x i4> %r
}
Transformation doesn't verify!
ERROR: Value mismatch

Example:
<3 x i4> %x = < #x0 (0), #xd (13, -3), #x0 (0) >
<3 x i4> %y = < undef, #x8 (8, -8), #x0 (0) >

Source:
<3 x i4> %n0 = < #x0 (0), #x5 (5), #x0 (0) >
<3 x i4> %n1 = < #x0 (0), #x0 (0)	[based on undef value], #x0 (0) >
<3 x i4> %r = < #x0 (0), #x8 (8, -8), #x0 (0) >

Target:
<3 x i4> %1 = < #x0 (0), #x1 (1), #x0 (0) >
<3 x i4> %2 = < #x0 (0), #x0 (0), #x0 (0) >
<3 x i4> %r = < #x0 (0), #x1 (1), #x0 (0) >
Source value: < #x0 (0), #x8 (8, -8), #x0 (0) >
Target value: < #x0 (0), #x1 (1), #x0 (0) >


https://web.ist.utl.pt/nuno.lopes/alive2/index.php?hash=2009353267698970&test=Transforms%2FInstCombine%2Funfold-masked-merge-with-const-mask-vector.ll
Comment 1 Sanjay Patel 2020-05-20 07:26:56 PDT

*** This bug has been marked as a duplicate of bug 45955 ***