diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-03-02 23:05:28 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-03-02 23:05:28 +0000 |
commit | f1bed4c720135b81ee46bd514cf3329abbf0c1a3 (patch) | |
tree | 996b80b1f4d3a124f426f9c96642aaeb62313f02 | |
parent | 4cf735b47e417f0ff4d0ce4e8b2d136c1fcb55b9 (diff) | |
download | external_llvm-f1bed4c720135b81ee46bd514cf3329abbf0c1a3.zip external_llvm-f1bed4c720135b81ee46bd514cf3329abbf0c1a3.tar.gz external_llvm-f1bed4c720135b81ee46bd514cf3329abbf0c1a3.tar.bz2 |
1. Sort switch cases using APInt safe comparison.
2. Make sure debug output of APInt values is safe for all bit widths.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34855 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/Utils/LowerSwitch.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Transforms/Utils/LowerSwitch.cpp b/lib/Transforms/Utils/LowerSwitch.cpp index bcbadd0..c005d42 100644 --- a/lib/Transforms/Utils/LowerSwitch.cpp +++ b/lib/Transforms/Utils/LowerSwitch.cpp @@ -59,7 +59,7 @@ namespace { const ConstantInt* CI1 = cast<const ConstantInt>(C1.first); const ConstantInt* CI2 = cast<const ConstantInt>(C2.first); - return CI1->getZExtValue() < CI2->getZExtValue(); + return CI1->getValue().ult(CI2->getValue()); } }; @@ -128,7 +128,7 @@ BasicBlock* LowerSwitch::switchConvert(CaseItr Begin, CaseItr End, Case& Pivot = *(Begin + Mid); DOUT << "Pivot ==> " - << cast<ConstantInt>(Pivot.first)->getSExtValue() << "\n"; + << cast<ConstantInt>(Pivot.first)->getValue().toStringSigned(10) << "\n"; BasicBlock* LBranch = switchConvert(LHS.begin(), LHS.end(), Val, OrigBlock, Default); |