summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2011-10-12 22:46:45 +0000
committerEli Friedman <eli.friedman@gmail.com>2011-10-12 22:46:45 +0000
commit979009ea616dd723b8c695ce85e735b8e1e6c66b (patch)
treee93011620485073b5819aa443314de2eeddcfdd6 /llvm/lib/CodeGen
parent000721f0583052d84557bad52ab8301086bdd467 (diff)
downloadbcm5719-llvm-979009ea616dd723b8c695ce85e735b8e1e6c66b.tar.gz
bcm5719-llvm-979009ea616dd723b8c695ce85e735b8e1e6c66b.zip
Use a utility from MathExtras to clarify a check and avoid undefined behavior. Based on patch by Ahmed Charles.
llvm-svn: 141829
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index c3a0df3333c..d11bd94cb09 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -1679,7 +1679,7 @@ void SelectionDAGBuilder::visitBitTestHeader(BitTestBlock &B,
UsePtrType = true;
else {
for (unsigned i = 0, e = B.Cases.size(); i != e; ++i)
- if ((uint64_t)((int64_t)B.Cases[i].Mask >> VT.getSizeInBits()) + 1 >= 2) {
+ if (!isUIntN(VT.getSizeInBits(), B.Cases[i].Mask)) {
// Switch table case range are encoded into series of masks.
// Just use pointer type, it's guaranteed to fit.
UsePtrType = true;
OpenPOWER on IntegriCloud