llvm-project/llvm/test
Sanjay Patel ec06b38130 [InstCombine] canonicalize 'not' ops before logical shifts
This reverses the existing transform that would uniformly canonicalize any 'xor' after any shift. In the case of logical shifts, that turns a 'not' into an arbitrary 'xor' with constant, and that's probably not as good for analysis, SCEV, or codegen.

The SCEV motivating case is discussed in:
http://bugs.llvm.org/PR47136

There's an analysis motivating case at:
http://bugs.llvm.org/PR38781

I did draft a patch that would do the same for 'ashr' but that's questionable because it's just swapping the position of a 'not' and uncovers at least 2 missing folds that we would probably need to deal with as preliminary steps.

Alive proofs:
https://rise4fun.com/Alive/BBV

  Name: shift right of 'not'
  Pre: C2 == (-1 u>> C1)
  %a = lshr i8 %x, C1
  %r = xor i8 %a, C2
  =>
  %n = xor i8 %x, -1
  %r = lshr i8 %n, C1

  Name: shift left of 'not'
  Pre: C2 == (-1 << C1)
  %a = shl i8 %x, C1
  %r = xor i8 %a, C2
  =>
  %n = xor i8 %x, -1
  %r = shl i8 %n, C1

  Name: ashr of 'not'
  %a = ashr i8 %x, C1
  %r = xor i8 %a, -1
  =>
  %n = xor i8 %x, -1
  %r = ashr i8 %n, C1

Differential Revision: https://reviews.llvm.org/D86243
2020-08-22 09:38:13 -04:00
..
Analysis [NFC][documentation] clarify comment in test 2020-08-21 14:30:47 -07:00
Assembler
Bindings [Bindings] Remove ipc_propagation. 2020-08-02 22:36:53 +01:00
Bitcode [NFC][StackSafety] Move out sort from the loop 2020-08-17 03:30:14 -07:00
BugPoint
CodeGen [AMDGPU] Avoid sorting stalls in regbank-reassign 2020-08-21 11:49:41 -07:00
DebugInfo [DebugInfo][test] Move distringtype.ll to X86/ subdir to fix failures when X86 target is not built 2020-08-21 23:14:36 -07:00
Demangle
Examples
ExecutionEngine [JITLink][MachO] Use correct symbol scope when N_PEXT is set and N_EXT unset. 2020-08-15 15:53:33 -07:00
Feature [NewPM][optnone] Mark various passes as required 2020-08-14 15:51:59 -07:00
FileCheck [FileCheck] Report captured variables 2020-07-28 19:15:18 -04:00
Instrumentation [MSAN] Avoid dangling ActualFnStart when replacing instruction 2020-08-14 23:50:38 +00:00
Integer
JitListener
LTO
Linker [test] XFAIL two tests with inlining debug info issues on Sparc 2020-08-13 11:12:52 +02:00
MC [PowerPC][PCRelative] Thread Local Storage Support for Initial Exec 2020-08-21 10:13:11 -05:00
MachineVerifier
Object [llvm-readobj/elf] - Refine the warning about the broken PT_DYNAMIC segment. 2020-08-17 14:57:19 +03:00
ObjectYAML Recommit: [DWARFYAML] Add support for referencing different abbrev tables. 2020-08-21 19:02:10 +08:00
Other [NewPM] Pin various tests under Other/ to legacy PM 2020-08-17 18:58:08 -07:00
Reduce [Reduce] Rewrite function body delta pass again 2020-08-08 23:48:44 +03:00
SafepointIRVerifier
Support
SymbolRewriter
TableGen Replace TableGen range piece punctuator with '...' 2020-08-21 23:33:57 +02:00
ThinLTO/X86 [ThinLTO] Import globals recursively 2020-08-20 12:13:43 +03:00
Transforms [InstCombine] canonicalize 'not' ops before logical shifts 2020-08-22 09:38:13 -04:00
Unit
Verifier [Statepoint] Remove code related to inline operand bundles 2020-08-14 20:29:41 -07:00
YAMLParser
tools Fix llvm/test/tools/lto/hide-linkonce-odr.ll 2020-08-21 18:32:35 -07:00
.clang-format
CMakeLists.txt [CMake] Simplify CMake handling for zlib 2020-08-11 20:22:11 -07:00
TestRunner.sh
lit.cfg.py Add test utility 'split-file' 2020-08-03 20:42:09 -07:00
lit.site.cfg.py.in [CMake] Simplify CMake handling for zlib 2020-08-11 20:22:11 -07:00