llvm-project/llvm/test
Roman Lebedev c584786854 [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
..
Analysis [CostModel] Model all `extractvalue`s as free. 2019-08-29 11:50:30 +00:00
Assembler Debug Info: Support for DW_AT_export_symbols for anonymous structs 2019-08-23 17:19:21 +00:00
Bindings Revert "Expose TailCallKind via the LLVM C API" 2019-08-15 03:49:51 +00:00
Bitcode [BitcodeReader] Check if we can create a null constant for type. 2019-08-21 18:20:11 +00:00
BugPoint
CodeGen [DebugInfo] LiveDebugValues: correctly discriminate kinds of variable locations 2019-08-29 11:20:54 +00:00
DebugInfo [DebugInfo] LiveDebugValues: correctly discriminate kinds of variable locations 2019-08-29 11:20:54 +00:00
Demangle
Examples
ExecutionEngine [JITLink] Don't under-align zero-fill sections. 2019-08-27 15:22:23 +00:00
Feature [FPEnv] Add fptosi and fptoui constrained intrinsics. 2019-08-28 16:33:36 +00:00
FileCheck [FileCheck] Move -dump-input diagnostic to first line 2019-08-14 02:56:09 +00:00
Instrumentation [ASan] Make insertion of version mismatch guard configurable 2019-08-28 20:40:55 +00:00
Integer
JitListener
LTO Revert r370105 - Update two x86 datalayouts for r370083, looks like racing commits 2019-08-28 01:55:06 +00:00
Linker IR: print value numbers for unnamed function arguments 2019-08-03 14:28:34 +00:00
MC [WebAssembly] Add atomic.fence instruction 2019-08-28 23:13:43 +00:00
MachineVerifier Remove unnecessary REQUIRES from a test. 2019-08-24 02:39:51 +00:00
Object [llvm-readobj/llvm-readelf] - Report a proper warning when dumping a broken dynamic relocation. 2019-08-29 10:55:57 +00:00
ObjectYAML [ObjectYAML] Fix lifetime issue in dumpDebugLines 2019-08-29 02:36:48 +00:00
Other [SlotIndexes] Add print-slotindexes to disable printing slotindexes 2019-08-22 13:44:47 +00:00
Reduce [Bugpoint redesign] Added Pass to Remove Global Variables 2019-08-15 22:54:09 +00:00
SafepointIRVerifier
Support
SymbolRewriter
TableGen GlobalISel/TableGen: Handle setcc patterns 2019-08-29 01:13:41 +00:00
ThinLTO/X86 Revert r370105 - Update two x86 datalayouts for r370083, looks like racing commits 2019-08-28 01:55:06 +00:00
Transforms [InstSimplify] Drop leftover "division-by-zero guard" around `@llvm.umul.with.overflow` inverted overflow bit 2019-08-29 12:48:04 +00:00
Unit
Verifier [IntrinsicEmitter] Support scalable vectors in intrinsics 2019-08-27 12:57:09 +00:00
YAMLParser
tools [yaml2obj] - Allow placing local symbols after globals. 2019-08-29 10:58:47 +00:00
.clang-format
CMakeLists.txt Added Delta IR Reduction Tool 2019-08-08 22:16:33 +00:00
TestRunner.sh
lit.cfg.py
lit.site.cfg.py.in