-
Notifications
You must be signed in to change notification settings - Fork 12.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[InstCombine] Fixing wrong select folding in vectors with undef eleme…
…nts (#102244) This PR fixes #98435. `SimplifyDemandedVectorElts` mishandles the undef by assuming that !isNullValue() means the condition is true. By preventing any value that we're not certain equals 1 or 0, it avoids having to make any particular choice by not demanding bits from a particular branch with potentially picking a wrong value. Proof: https://alive2.llvm.org/ce/z/r8CmEu
- Loading branch information
Showing
2 changed files
with
15 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 | ||
; RUN: opt -S -passes=instcombine < %s 2>&1 | FileCheck %s | ||
|
||
define <2 x i1> @pr98435(<2 x i1> %val) { | ||
; CHECK-LABEL: define <2 x i1> @pr98435( | ||
; CHECK-SAME: <2 x i1> [[VAL:%.*]]) { | ||
; CHECK-NEXT: [[VAL1:%.*]] = select <2 x i1> <i1 undef, i1 true>, <2 x i1> <i1 true, i1 true>, <2 x i1> [[VAL]] | ||
; CHECK-NEXT: ret <2 x i1> [[VAL1]] | ||
; | ||
%val1 = select <2 x i1> <i1 undef, i1 true>, <2 x i1> <i1 true, i1 true>, <2 x i1> %val | ||
ret <2 x i1> %val1 | ||
} |