From a1dafe0b863f4439c10936628f1839a1da40ec02 Mon Sep 17 00:00:00 2001 From: Vitaly Buka Date: Tue, 17 Oct 2017 18:33:15 +0000 Subject: [PATCH] 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 --- lib/Transforms/Utils/SimplifyCFG.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- 2.40.0