Skip to content

Commit aef4fbe

Browse files
committed
[X86][GlobalISel] Fix referencing nonexistent operand in G_ICMP
1 parent 51d5b65 commit aef4fbe

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

llvm/lib/Target/X86/GISel/X86LegalizerInfo.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,7 @@ X86LegalizerInfo::X86LegalizerInfo(const X86Subtarget &STI,
259259
getActionDefinitionsBuilder(G_ICMP)
260260
.legalForCartesianProduct({s8}, Is64Bit ? IntTypes64 : IntTypes32)
261261
.clampScalar(0, s8, s8)
262-
.clampScalar(1, s8, sMaxScalar)
263-
.scalarSameSizeAs(2, 1);
262+
.clampScalar(1, s8, sMaxScalar);
264263

265264
// bswap
266265
getActionDefinitionsBuilder(G_BSWAP)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# RUN: llc -mtriple=x86_64-linux-gnu -run-pass=legalizer -global-isel-abort=2 -pass-remarks-missed='gisel*' %s -o - 2>%t | FileCheck %s
2+
# RUN: FileCheck -check-prefix=ILLEGAL %s < %t
3+
4+
# ILLEGAL: remark: <unknown>:0:0: unable to legalize instruction: %2:_(<4 x s1>) = G_ICMP intpred(sle), %0:_(<4 x s64>), %1:_ (in function: test_icmp_v4i64)
5+
6+
---
7+
name: test_icmp_v4i64
8+
tracksRegLiveness: true
9+
body: |
10+
bb.1:
11+
; CHECK-LABEL: name: test_icmp_v4i64
12+
; CHECK: [[DEF:%[0-9]+]]:_(<4 x s64>) = G_IMPLICIT_DEF
13+
; CHECK-NEXT: [[DEF1:%[0-9]+]]:_(<4 x s64>) = G_IMPLICIT_DEF
14+
; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(<4 x s1>) = G_ICMP intpred(sle), [[DEF]](<4 x s64>), [[DEF1]]
15+
; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(<4 x s32>) = G_ANYEXT [[ICMP]](<4 x s1>)
16+
; CHECK-NEXT: $xmm0 = COPY [[ANYEXT]](<4 x s32>)
17+
; CHECK-NEXT: RET 0, implicit $xmm0
18+
%0:_(<4 x s64>) = G_IMPLICIT_DEF
19+
%1:_(<4 x s64>) = G_IMPLICIT_DEF
20+
%3:_(<4 x s1>) = G_ICMP intpred(sle), %0(<4 x s64>), %1
21+
%4:_(<4 x s32>) = G_ANYEXT %3(<4 x s1>)
22+
$xmm0 = COPY %4(<4 x s32>)
23+
RET 0, implicit $xmm0
24+
...

0 commit comments

Comments
 (0)