[PATCH] D59218: [LSR] Fix signed overflow in GenerateCrossUseConstantOffsets.
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 22 16:10:27 PDT 2019
efriedma added inline comments.
================
Comment at: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:4152
+ // See PR41034.
+ Imms.lower_bound(((uint64_t)Imms.begin()->first + std::prev(Imms.end())->first) /
2)
----------------
This code is trying to compute (x+y)/2. Mathematically, this can't overflow, so this shouldn't require a bitwidth to produce a meaningful result.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59218/new/
https://reviews.llvm.org/D59218
More information about the llvm-commits
mailing list