summaryrefslogtreecommitdiffstats
path: root/llvm/test/Verifier
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2019-02-04 23:29:31 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2019-02-04 23:29:31 +0000
commit1f795e2c2a0b81d71f69621649b21cb7b1e616b4 (patch)
tree81569a0ea2e7f49b2d86aafa5425248ee5a6bdeb /llvm/test/Verifier
parentf2a26339e2bdd5a13982d21d21c0bdf1d37b9ab8 (diff)
downloadbcm5719-llvm-1f795e2c2a0b81d71f69621649b21cb7b1e616b4.tar.gz
bcm5719-llvm-1f795e2c2a0b81d71f69621649b21cb7b1e616b4.zip
GlobalISel: Enforce operand types for constants
A number of of tests were using imm operands, not cimm. Since CSE relies on the exact ConstantInt* pointer used, and implicit conversions are generally evil, also enforce the bitsize of the types. llvm-svn: 353113
Diffstat (limited to 'llvm/test/Verifier')
-rw-r--r--llvm/test/Verifier/test_g_constant.mir28
-rw-r--r--llvm/test/Verifier/test_g_fconstant.mir24
-rw-r--r--llvm/test/Verifier/test_phis_precede_nonphis.mir2
3 files changed, 49 insertions, 5 deletions
diff --git a/llvm/test/Verifier/test_g_constant.mir b/llvm/test/Verifier/test_g_constant.mir
index 2fa8d03505c..fa5daff870b 100644
--- a/llvm/test/Verifier/test_g_constant.mir
+++ b/llvm/test/Verifier/test_g_constant.mir
@@ -1,4 +1,4 @@
-#RUN: not llc -o - -global-isel -run-pass=none -verify-machineinstrs %s 2>&1 | FileCheck %s
+#RUN: not llc -march=aarch64 -o /dev/null -run-pass=none -verify-machineinstrs %s 2>&1 | FileCheck %s
# REQUIRES: global-isel, aarch64-registered-target
---
@@ -10,9 +10,33 @@ tracksRegLiveness: true
liveins:
body: |
bb.0:
- ; CHECK: Bad machine code: Instruction cannot use a vector result type
+ ; CHECK: Bad machine code: Instruction cannot use a vector result type
+ ; CHECK: Bad machine code: inconsistent constant size
%0:_(<2 x s32>) = G_CONSTANT i32 0
; CHECK: Bad machine code: Too few operands
%1:_(s32) = G_CONSTANT
+
+ ; Not a cimm
+ ; CHECK: Bad machine code: G_CONSTANT operand must be cimm
+ %2:_(s32) = G_CONSTANT 0
+
+ ; Not a cimm
+ ; CHECK: Bad machine code: G_CONSTANT operand must be cimm
+ %3:_(s32) = G_CONSTANT float 1.0
+
+ ; Size is bigger than result
+ ; CHECK: Bad machine code: inconsistent constant size
+ %4:_(s32) = G_CONSTANT i64 0
+
+ ; Size is smaller than result
+ ; CHECK: Bad machine code: inconsistent constant size
+ %4:_(s32) = G_CONSTANT i16 0
+
+ ; CHECK: Bad machine code: inconsistent constant size
+ %5:_(p0) = G_CONSTANT i32 0
+
+ ; CHECK: Bad machine code: inconsistent constant size
+ %6:_(p0) = G_CONSTANT i128 0
+
...
diff --git a/llvm/test/Verifier/test_g_fconstant.mir b/llvm/test/Verifier/test_g_fconstant.mir
index fecc47de5be..d917d9c846f 100644
--- a/llvm/test/Verifier/test_g_fconstant.mir
+++ b/llvm/test/Verifier/test_g_fconstant.mir
@@ -1,8 +1,8 @@
-#RUN: not llc -o - -global-isel -run-pass=none -verify-machineinstrs %s 2>&1 | FileCheck %s
+#RUN: not llc -march=aarch64 -o /dev/null -run-pass=none -verify-machineinstrs %s 2>&1 | FileCheck %s
# REQUIRES: global-isel, aarch64-registered-target
---
-name: test_fconstant_vector
+name: test_fconstant
legalized: true
regBankSelected: false
selected: false
@@ -12,4 +12,24 @@ body: |
bb.0:
; CHECK: Bad machine code: Instruction cannot use a vector result type
%0:_(<2 x s32>) = G_FCONSTANT float 0.0
+
+ ; CHECK: Bad machine code: Too few operands
+ %1:_(s32) = G_FCONSTANT
+
+ ; Not a cimm
+ ; CHECK: Bad machine code: G_FCONSTANT operand must be fpimm
+ %2:_(s32) = G_FCONSTANT 0
+
+ ; Not a cimm
+ ; CHECK: Bad machine code: G_FCONSTANT operand must be fpimm
+ %3:_(s32) = G_FCONSTANT i32 0
+
+ ; Size is bigger than result
+ ; CHECK: Bad machine code: inconsistent constant size
+ %4:_(s32) = G_FCONSTANT double 1.0
+
+ ; Size is smaller than result
+ ; CHECK: Bad machine code: inconsistent constant size
+ %4:_(s32) = G_FCONSTANT half 1.0
+
...
diff --git a/llvm/test/Verifier/test_phis_precede_nonphis.mir b/llvm/test/Verifier/test_phis_precede_nonphis.mir
index 29409798d1b..fa69b40fddf 100644
--- a/llvm/test/Verifier/test_phis_precede_nonphis.mir
+++ b/llvm/test/Verifier/test_phis_precede_nonphis.mir
@@ -44,7 +44,7 @@ body: |
G_BR %bb.3.exit
bb.2.else:
successors: %bb.3(0x80000000)
- %6:_(s32) = G_CONSTANT i8 1
+ %6:_(s32) = G_CONSTANT i32 1
%7:_(s8) = G_TRUNC %6
G_BR %bb.3.exit
bb.3.exit:
OpenPOWER on IntegriCloud