1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00
Go to file
Roman Lebedev be469fea7d [InstSimplify] Drop leftover "division-by-zero guard" around @llvm.umul.with.overflow inverted overflow bit
Summary:
Now that with D65143/D65144 we've produce `@llvm.umul.with.overflow`,
and with D65147 we've flattened the CFG, we now can see that
the guard may have been there to prevent division by zero is redundant.
We can simply drop it:
```
----------------------------------------
Name: no overflow or zero
  %iszero = icmp eq i4 %y, 0
  %umul = smul_overflow i4 %x, %y
  %umul.ov = extractvalue {i4, i1} %umul, 1
  %umul.ov.not = xor %umul.ov, -1
  %retval.0 = or i1 %iszero, %umul.ov.not
  ret i1 %retval.0
=>
  %iszero = icmp eq i4 %y, 0
  %umul = smul_overflow i4 %x, %y
  %umul.ov = extractvalue {i4, i1} %umul, 1
  %umul.ov.not = xor %umul.ov, -1
  %retval.0 = or i1 %iszero, %umul.ov.not
  ret i1 %umul.ov.not

Done: 1
Optimization is correct!
```
Note that this is inverted from what we have in a previous patch,
here we are looking for the inverted overflow bit.
And that inversion is kinda problematic - given this particular
pattern we neither hoist that `not` closer to `ret` (then the pattern
would have been identical to the one without inversion,
and would have been handled by the previous patch), neither
do the opposite transform. But regardless, we should handle this too.
I've filled [[ https://bugs.llvm.org/show_bug.cgi?id=42720 | PR42720 ]].

Reviewers: nikic, spatel, xbolva00, RKSimon

Reviewed By: spatel

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D65151

llvm-svn: 370351
2019-08-29 12:48:04 +00:00
benchmarks Pull google/benchmark library to the LLVM tree 2018-08-28 09:42:41 +00:00
bindings Bump llvm-go to C++14 2019-08-15 10:55:25 +00:00
cmake [CMake] Update C4324 MSVC warning comment to explain its still broken at VS2019 2019-08-20 11:20:05 +00:00
docs [X86][ReleaseNotes] Add a note about the switch to widening legalization for narrow vectors. 2019-08-28 17:18:56 +00:00
examples [ORCv2] - New Speculate Query Implementation 2019-08-27 18:23:36 +00:00
include [CostModel] Model all extractvalues as free. 2019-08-29 11:50:30 +00:00
lib [InstSimplify] Drop leftover "division-by-zero guard" around @llvm.umul.with.overflow inverted overflow bit 2019-08-29 12:48:04 +00:00
projects [libc++] Take 2: Integrate the PSTL into libc++ 2019-08-05 18:29:14 +00:00
resources
runtimes Setup testing target dependencies for default runtimes 2019-06-11 00:25:57 +00:00
test [InstSimplify] Drop leftover "division-by-zero guard" around @llvm.umul.with.overflow inverted overflow bit 2019-08-29 12:48:04 +00:00
tools [llvm-readobj/llvm-readelf] - Report a proper warning when dumping a broken dynamic relocation. 2019-08-29 10:55:57 +00:00
unittests Fix for "DICompileUnit not listed in llvm.dbg.cu" verification error after ... 2019-08-28 21:27:50 +00:00
utils GlobalISel/TableGen: Handle setcc patterns 2019-08-29 01:13:41 +00:00
.arcconfig
.clang-format
.clang-tidy Disable tidy checks with too many hits 2019-02-01 11:20:13 +00:00
.gitattributes [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
.gitignore gitignore: Ignore Qt Creator project configuration files. NFC 2019-06-12 08:28:31 +00:00
CMakeLists.txt Revert Autogenerate the shebang lines for tools/opt-viewer 2019-08-27 18:31:29 +00:00
CODE_OWNERS.TXT Update email address in CODE_OWNERS 2019-07-01 16:01:15 +00:00
configure
CREDITS.TXT Update email address. 2019-07-17 07:02:02 +00:00
LICENSE.TXT Fix typos throughout the license files that somehow I and my reviewers 2019-01-21 09:52:34 +00:00
llvm.spec.in Update structured references to the license to the new license. 2019-01-19 11:30:51 +00:00
LLVMBuild.txt Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
README.txt Testing commit access 2019-02-19 20:38:51 +00:00
RELEASE_TESTERS.TXT Update the list of platforms & archs 2018-12-16 14:47:16 +00:00

The LLVM Compiler Infrastructure
================================

This directory and its subdirectories contain source code for LLVM,
a toolkit for the construction of highly optimized compilers,
optimizers, and runtime environments.

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.

Please see the documentation provided in docs/ for further
assistance with LLVM, and in particular docs/GettingStarted.rst for getting
started with LLVM and docs/README.txt for an overview of LLVM's
documentation setup.

If you are writing a package for LLVM, see docs/Packaging.rst for our
suggestions.