Skip to content

Commit de8d412

Browse files
author
Thorsten Schütt
committed
address review comments
forbid pointers
1 parent 5b64f0a commit de8d412

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

llvm/lib/CodeGen/MachineVerifier.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,6 +1550,12 @@ 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);
1556+
break;
1557+
}
1558+
15531559
if ((DstTy.isVector() != SrcTy.isVector()) ||
15541560
(DstTy.isVector() &&
15551561
DstTy.getElementCount() != SrcTy.getElementCount())) {
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
1-
# RUN: not --crash llc -verify-machineinstrs -mtriple=arm64 -run-pass none -o /dev/null %s 2>&1 | FileCheck %s
1+
# RUN: not --crash llc -verify-machineinstrs -run-pass none -mtriple=arm64 -o /dev/null %s 2>&1 | FileCheck %s
22
# REQUIRES: aarch64-registered-target
33

44
---
55
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
12+
%14:_(p0) = G_SCMP %12, %13
13+
914
%3:_(<2 x s32>) = G_IMPLICIT_DEF
1015
%4:_(<2 x s32>) = G_IMPLICIT_DEF
1116
; CHECK: Generic vector scmp/ucmp must preserve number of lanes
1217
%5:_(s1) = G_UCMP %3, %4
1318
14-
%12:_(s32) = G_CONSTANT i32 0
15-
%13:_(s64) = G_CONSTANT i64 2
19+
%15:_(s32) = G_CONSTANT i32 0
20+
%16:_(s64) = G_CONSTANT i64 2
1621
; CHECK: Generic scmp/ucmp must have same input types
17-
%14:_(s1) = G_SCMP %12, %13
22+
%17:_(s1) = G_SCMP %15, %16
23+
24+
1825
1926
...

0 commit comments

Comments
 (0)