aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/ConstantFold.cpp
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2018-06-20 19:02:17 +0000
committerSanjay Patel <spatel@rotateright.com>2018-06-20 19:02:17 +0000
commit3597588493192c58e2d455de3a024c398488f6e9 (patch)
tree1e1f26f94a78d6db14e1b036157a5f7fc43df20f /llvm/lib/IR/ConstantFold.cpp
parent4da3331d3d77aaf0adb2ab3325405a72bdad1a5a (diff)
downloadllvm-3597588493192c58e2d455de3a024c398488f6e9.zip
llvm-3597588493192c58e2d455de3a024c398488f6e9.tar.gz
llvm-3597588493192c58e2d455de3a024c398488f6e9.tar.bz2
[IR] add/use isIntDivRem convenience function
There are more existing potential users of this, but I've limited this patch to the first couple that I found to minimize typo risk. llvm-svn: 335157
Diffstat (limited to 'llvm/lib/IR/ConstantFold.cpp')
-rw-r--r--llvm/lib/IR/ConstantFold.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp
index 514a534..f36667e 100644
--- a/llvm/lib/IR/ConstantFold.cpp
+++ b/llvm/lib/IR/ConstantFold.cpp
@@ -1227,9 +1227,7 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode,
Constant *RHS = ConstantExpr::getExtractElement(C2, ExtractIdx);
// If any element of a divisor vector is zero, the whole op is undef.
- if ((Opcode == Instruction::SDiv || Opcode == Instruction::UDiv ||
- Opcode == Instruction::SRem || Opcode == Instruction::URem) &&
- RHS->isNullValue())
+ if (Instruction::isIntDivRem(Opcode) && RHS->isNullValue())
return UndefValue::get(VTy);
Result.push_back(ConstantExpr::get(Opcode, LHS, RHS));