summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/StringRef.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2012-04-23 00:27:54 +0000
committerChris Lattner <sabre@nondot.org>2012-04-23 00:27:54 +0000
commit5e14666149f54e9817008e8c6057852a23a092bb (patch)
tree64fe1fe129554d1916f96ff06e38ceacc2655746 /llvm/lib/Support/StringRef.cpp
parente32c23a5e0909f94886083478c55e6953978cc20 (diff)
downloadbcm5719-llvm-5e14666149f54e9817008e8c6057852a23a092bb.tar.gz
bcm5719-llvm-5e14666149f54e9817008e8c6057852a23a092bb.zip
Don't die with an assertion if the Result bitwidth is already correct. This
fixes an assert reading "1239123123123123" when the result is already 64-bit. llvm-svn: 155329
Diffstat (limited to 'llvm/lib/Support/StringRef.cpp')
-rw-r--r--llvm/lib/Support/StringRef.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Support/StringRef.cpp b/llvm/lib/Support/StringRef.cpp
index 14d314b7697..97af0fff5ee 100644
--- a/llvm/lib/Support/StringRef.cpp
+++ b/llvm/lib/Support/StringRef.cpp
@@ -391,7 +391,7 @@ bool StringRef::getAsInteger(unsigned Radix, APInt &Result) const {
unsigned BitWidth = Log2Radix * Str.size();
if (BitWidth < Result.getBitWidth())
BitWidth = Result.getBitWidth(); // don't shrink the result
- else
+ else if (BitWidth > Result.getBitWidth())
Result = Result.zext(BitWidth);
APInt RadixAP, CharAP; // unused unless !IsPowerOf2Radix
OpenPOWER on IntegriCloud