summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2018-06-07 20:03:45 +0000
committerRoman Lebedev <lebedev.ri@gmail.com>2018-06-07 20:03:45 +0000
commit2683802ba086fd8d0ff981dda17ff096e8be4f25 (patch)
treed571235f5ea6fbaf458fcf96559b44bc2755dd6f /clang/lib/Frontend/CompilerInvocation.cpp
parent1f67a3cba9b09636c56e2109d8a35ae96dc15782 (diff)
downloadbcm5719-llvm-2683802ba086fd8d0ff981dda17ff096e8be4f25.tar.gz
bcm5719-llvm-2683802ba086fd8d0ff981dda17ff096e8be4f25.zip
[InstSimplify] shl nuw C, %x -> C iff signbit is set on C.
Summary: `%r = shl nuw i8 C, %x` As per langref: ``` If the nuw keyword is present, then the shift produces a poison value if it shifts out any non-zero bits. ``` Thus, if the sign bit is set on `C`, then `%x` can only be `0`, which means that `%r` can only be `C`. Or in other words, set sign bit means that the signed value is negative, so the constant is `<= 0`. https://rise4fun.com/Alive/WMk https://rise4fun.com/Alive/udv Was mentioned in D47428 review. We already handle the `0` constant, https://godbolt.org/g/UZq1sJ, so this only handles negative constants. Could use computeKnownBits() / LazyValueInfo, but the cost-benefit analysis (https://reviews.llvm.org/D47891) suggests it isn't worth it. Reviewers: spatel, craig.topper Reviewed By: spatel Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D47883 llvm-svn: 334222
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud