summaryrefslogtreecommitdiff
path: root/tools/llvm-stress
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2017-07-09 07:04:00 +0000
committerCraig Topper <craig.topper@intel.com>2017-07-09 07:04:00 +0000
commit1060082924cb76a0e05505daf22a925246de3873 (patch)
tree1ec40fc74b62351056cacf80947ea29506882a3e /tools/llvm-stress
parentcc60d7b17de095ac429f5066d0bea80837fabb65 (diff)
[IR] Make use of Type::isPtrOrPtrVectorTy/isIntOrIntVectorTy/isFPOrFPVectorTy to shorten code. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307491 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-stress')
-rw-r--r--tools/llvm-stress/llvm-stress.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/tools/llvm-stress/llvm-stress.cpp b/tools/llvm-stress/llvm-stress.cpp
index 3cf8b37bc2e..3945da7020b 100644
--- a/tools/llvm-stress/llvm-stress.cpp
+++ b/tools/llvm-stress/llvm-stress.cpp
@@ -385,10 +385,10 @@ struct ConstModifier: public Modifier {
if (Ty->isVectorTy()) {
switch (getRandom() % 2) {
- case 0: if (Ty->getScalarType()->isIntegerTy())
+ case 0: if (Ty->isIntOrIntVectorTy())
return PT->push_back(ConstantVector::getAllOnesValue(Ty));
break;
- case 1: if (Ty->getScalarType()->isIntegerTy())
+ case 1: if (Ty->isIntOrIntVectorTy())
return PT->push_back(ConstantVector::getNullValue(Ty));
}
}
@@ -531,8 +531,7 @@ struct CastModifier: public Modifier {
}
// Both types are integers:
- if (VTy->getScalarType()->isIntegerTy() &&
- DestTy->getScalarType()->isIntegerTy()) {
+ if (VTy->isIntOrIntVectorTy() && DestTy->isIntOrIntVectorTy()) {
if (VSize > DestSize) {
return PT->push_back(
new TruncInst(V, DestTy, "Tr", BB->getTerminator()));
@@ -546,8 +545,7 @@ struct CastModifier: public Modifier {
}
// Fp to int.
- if (VTy->getScalarType()->isFloatingPointTy() &&
- DestTy->getScalarType()->isIntegerTy()) {
+ if (VTy->isFPOrFPVectorTy() && DestTy->isIntOrIntVectorTy()) {
if (getRandom() & 1)
return PT->push_back(
new FPToSIInst(V, DestTy, "FC", BB->getTerminator()));
@@ -555,8 +553,7 @@ struct CastModifier: public Modifier {
}
// Int to fp.
- if (VTy->getScalarType()->isIntegerTy() &&
- DestTy->getScalarType()->isFloatingPointTy()) {
+ if (VTy->isIntOrIntVectorTy() && DestTy->isFPOrFPVectorTy()) {
if (getRandom() & 1)
return PT->push_back(
new SIToFPInst(V, DestTy, "FC", BB->getTerminator()));
@@ -565,8 +562,7 @@ struct CastModifier: public Modifier {
}
// Both floats.
- if (VTy->getScalarType()->isFloatingPointTy() &&
- DestTy->getScalarType()->isFloatingPointTy()) {
+ if (VTy->isFPOrFPVectorTy() && DestTy->isFPOrFPVectorTy()) {
if (VSize > DestSize) {
return PT->push_back(
new FPTruncInst(V, DestTy, "Tr", BB->getTerminator()));