llvm-project/llvm/test
Jakub Kuderski 3d29c41ad5 [InstCombine] Insert instructions before adding them to worklist
Summary:
This patch adds instructions to the InstCombine worklist after they are properly inserted. This way we don't get `<badref>`s printed when logging added instructions.
It also adds a check in `Worklist::Add` that ensures that all added instructions have parents.

Simple test case that illustrates the difference when run with `--debug-only=instcombine`:

```
define i32 @test35(i32 %a, i32 %b) {
  %1 = or i32 %a, 1135
  %2 = or i32 %1, %b
  ret i32 %2
}
```

Before this patch:
```
INSTCOMBINE ITERATION #1 on test35
IC: ADDING: 3 instrs to worklist
IC: Visiting:   %1 = or i32 %a, 1135
IC: Visiting:   %2 = or i32 %1, %b
IC: ADD:   %2 = or i32 %a, %b
IC: Old =   %3 = or i32 %1, %b
    New =   <badref> = or i32 %2, 1135
IC: ADD:   <badref> = or i32 %2, 1135
...
```

With this patch:
```
INSTCOMBINE ITERATION #1 on test35
IC: ADDING: 3 instrs to worklist
IC: Visiting:   %1 = or i32 %a, 1135
IC: Visiting:   %2 = or i32 %1, %b
IC: ADD:   %2 = or i32 %a, %b
IC: Old =   %3 = or i32 %1, %b
    New =   <badref> = or i32 %2, 1135
IC: ADD:   %3 = or i32 %2, 1135
...
```

Reviewers: fhahn, davide, spatel, foad, grosser, nikic

Reviewed By: nikic

Subscribers: nikic, lebedev.ri, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D71093
2019-12-18 14:55:41 -05:00
..
Analysis [AMDGPU] Fixed cost model for packed 16 bit ops 2019-12-17 15:14:17 -08:00
Assembler [DebugInfo] Remove the DIFlagArgumentNotModified debug info flag 2019-11-20 13:18:40 +01:00
Bindings Updated the OCaml/bitwriter.ml test for OCaml 4.06+ 2019-11-30 13:35:23 +01:00
Bitcode Add support for multi-module bitcode files to llvm-dis 2019-11-14 10:40:41 -08:00
BugPoint [Bugpoint] Do not create illegal function attribute combos 2019-12-16 10:32:35 -06:00
CodeGen Revert "[AArch64][SVE] Replace integer immediate intrinsics with splat vector variant" 2019-12-18 14:14:10 -05:00
DebugInfo Reapply: [DebugInfo] Correctly handle salvaged casts and split fragments at ISel 2019-12-18 16:26:42 +00:00
Demangle
Examples Revert "[Examples] Add IRTransformations directory to examples." 2019-12-01 22:20:20 +00:00
ExecutionEngine [ORC][JITLink] Add support for weak references, and improve handling of static 2019-11-28 13:30:49 -08:00
Feature This adds constrained intrinsics for the signed and unsigned conversions 2019-12-17 10:06:51 -05:00
FileCheck [FileCheck] Given multiple -dump-input, prefer most verbose 2019-12-03 14:21:13 -05:00
Instrumentation hwasan: add tag_offset DWARF attribute to optimized debug info 2019-12-12 16:18:54 -08:00
Integer
JitListener
LTO [LTO] Support for embedding bitcode section during LTO 2019-12-12 12:34:19 -08:00
Linker [IRMover] Set Address Space for moved global values 2019-11-05 16:32:48 -08:00
MC [ MC ] Match labels to existing fragments even when switching sections. 2019-12-18 09:55:54 -08:00
MachineVerifier [MachineVerifier] Improve checks of target instructions operands. 2019-12-03 10:20:52 +01:00
Object [llvm-readelf/llvm-readobj] - Improved the error reporting in a few method related to versioning. 2019-12-10 13:08:18 +03:00
ObjectYAML
Other Revert "[VectorUtils] Introduce the Vector Function Database (VFDatabase)." 2019-12-13 19:42:04 +00:00
Reduce
SafepointIRVerifier
Support
SymbolRewriter
TableGen Revert "Temporarily Revert "[gicombiner] Add the MatchDag structure and parse instruction DAG's from the input"" 2019-12-18 11:37:12 +00:00
ThinLTO/X86 [ThinLTO] Show preserved symbols in DOT files 2019-12-18 18:33:15 +03:00
Transforms [InstCombine] Insert instructions before adding them to worklist 2019-12-18 14:55:41 -05:00
Unit
Verifier Verifier: Check frame-pointer attribute values 2019-12-11 19:53:49 +05:30
YAMLParser
tools [llvm-exegesis][mips] Add lit test 2019-12-18 10:21:06 +01:00
.clang-format
CMakeLists.txt [cmake] Add llvm-locstats to LLVM_TEST_DEPENDS 2019-12-18 09:54:21 +01:00
TestRunner.sh
lit.cfg.py Introduce llvm-install-name-tool 2019-11-19 23:42:37 -08:00
lit.site.cfg.py.in