summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/MicrosoftCXXABI.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2018-05-31 22:16:55 +0000
committerCraig Topper <craig.topper@intel.com>2018-05-31 22:16:55 +0000
commit9a6c0bdcbd387c67fc3016db40f7d261bd0691bc (patch)
treeb62e218d8ad7728743a4450e95ec10c87534fda0 /clang/lib/CodeGen/MicrosoftCXXABI.cpp
parent38671237a62ae9954a241cdeaf3a3180482ecf2b (diff)
downloadbcm5719-llvm-9a6c0bdcbd387c67fc3016db40f7d261bd0691bc.tar.gz
bcm5719-llvm-9a6c0bdcbd387c67fc3016db40f7d261bd0691bc.zip
[LoopIdiomRecognize] Only convert loops to ctlz if we can prove that the input is non-negative.
Summary: Loop idiom recognize tries to convert loops like ``` int foo(int x) { int cnt = 0; while (x) { x >>= 1; ++cnt; } return cnt; } ``` into calls to ctlz, but if x is initially negative this loop should be infinite. It happens that the cases that motivated this change have an absolute value of x before the loop. So this patch restricts the transform to cases where we know x is positive. Note: We are relying on the absolute value of INT_MIN to be undefined so we can assume that the result is always positive. Fixes PR37479 Reviewers: spatel, hfinkel, efriedma, javed.absar Reviewed By: efriedma Subscribers: dmgreen, llvm-commits Differential Revision: https://reviews.llvm.org/D47348 llvm-svn: 333702
Diffstat (limited to 'clang/lib/CodeGen/MicrosoftCXXABI.cpp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud