From: Vitaly Buka Date: Tue, 17 Oct 2017 18:33:15 +0000 (+0000) Subject: Fix signed overflow detected by ubsan X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a1dafe0b863f4439c10936628f1839a1da40ec02;p=llvm Fix signed overflow detected by ubsan This overflow does not affect algorithm, so just suppress it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316018 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp index 63bf68e4cee..e7388f63864 100644 --- a/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/lib/Transforms/Utils/SimplifyCFG.cpp @@ -5439,7 +5439,7 @@ static bool ReduceSwitchRange(SwitchInst *SI, IRBuilder<> &Builder, // First, transform the values such that they start at zero and ascend. int64_t Base = Values[0]; for (auto &V : Values) - V -= Base; + V -= (uint64_t)(Base); // Now we have signed numbers that have been shifted so that, given enough // precision, there are no negative values. Since the rest of the transform