Skip to content

Commit 5c18b51

Browse files
author
Thorsten Schütt
committed
address review comments II
improve pointer parameter/result detection
1 parent de8d412 commit 5c18b51

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

llvm/lib/CodeGen/MachineVerifier.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,9 +1550,13 @@ void MachineVerifier::verifyPreISelGenericInstruction(const MachineInstr *MI) {
15501550
LLT SrcTy = MRI->getType(MI->getOperand(1).getReg());
15511551
LLT SrcTy2 = MRI->getType(MI->getOperand(2).getReg());
15521552

1553-
if (DstTy.isPointerOrPointerVector() || SrcTy.isPointerOrPointerVector() ||
1554-
SrcTy2.isPointerOrPointerVector()) {
1555-
report("Generic scmp/ucmp does not support pointers", MI);
1553+
if (SrcTy.isPointerOrPointerVector() || SrcTy2.isPointerOrPointerVector()) {
1554+
report("Generic scmp/ucmp does not support pointers as operands", MI);
1555+
break;
1556+
}
1557+
1558+
if (DstTy.isPointerOrPointerVector()) {
1559+
report("Generic scmp/ucmp does not support pointers as a result", MI);
15561560
break;
15571561
}
15581562

llvm/test/MachineVerifier/test_uscmp.mir

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,20 @@ name: test_uscmp
66
body: |
77
bb.0:
88
9-
%12:_(p0) = G_IMPLICIT_DEF
10-
%13:_(p0) = G_IMPLICIT_DEF
11-
; CHECK: Generic scmp/ucmp does not support pointers
9+
%2:_(p0) = G_IMPLICIT_DEF
10+
%3:_(p0) = G_IMPLICIT_DEF
11+
; CHECK: Generic scmp/ucmp does not support pointers as operands
12+
%4:_(s1) = G_SCMP %2, %3
13+
14+
%12:_(s64) = G_IMPLICIT_DEF
15+
%13:_(s64) = G_IMPLICIT_DEF
16+
; CHECK: Generic scmp/ucmp does not support pointers as a result
1217
%14:_(p0) = G_SCMP %12, %13
1318
14-
%3:_(<2 x s32>) = G_IMPLICIT_DEF
15-
%4:_(<2 x s32>) = G_IMPLICIT_DEF
19+
%23:_(<2 x s32>) = G_IMPLICIT_DEF
20+
%24:_(<2 x s32>) = G_IMPLICIT_DEF
1621
; CHECK: Generic vector scmp/ucmp must preserve number of lanes
17-
%5:_(s1) = G_UCMP %3, %4
22+
%5:_(s1) = G_UCMP %23, %24
1823
1924
%15:_(s32) = G_CONSTANT i32 0
2025
%16:_(s64) = G_CONSTANT i64 2

0 commit comments

Comments
 (0)