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 | 1e102971d2fb3a61b2a5662161c8552e677b7037 (patch) | |
tree | ccb08776f02b65147f2b5bfc1eb31e54f43b7a71 /llvm/lib/Transforms/Utils/LowerSwitch.cpp | |
parent | 43376a74af423286955a04a7a0ddb5918669ac6d (diff) | |
download | bcm5719-llvm-1e102971d2fb3a61b2a5662161c8552e677b7037.tar.gz bcm5719-llvm-1e102971d2fb3a61b2a5662161c8552e677b7037.zip |
1. Sort switch cases using APInt safe comparison.
2. Make sure debug output of APInt values is safe for all bit widths.
llvm-svn: 34855
Diffstat (limited to 'llvm/lib/Transforms/Utils/LowerSwitch.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LowerSwitch.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/LowerSwitch.cpp b/llvm/lib/Transforms/Utils/LowerSwitch.cpp index bcbadd0040c..c005d42197e 100644 --- a/llvm/lib/Transforms/Utils/LowerSwitch.cpp +++ b/llvm/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); |