llvm-project/llvm/test
Florian Hahn 22a44bca40 [SCCP] Propagate integer range info for parameters in IPSCCP.
Summary:
This updates the SCCP solver to use of the ValueElement lattice for 
parameters, which provides integer range information. The range
information is used to remove unneeded icmp instructions.

For the following function, f() can be optimized to `ret i32 2` with
this change

  source_filename = "sccp.c"
  target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
  target triple = "x86_64-unknown-linux-gnu"
  
  ; Function Attrs: norecurse nounwind readnone uwtable
  define i32 @main() local_unnamed_addr #0 {
  entry:
    %call = tail call fastcc i32 @f(i32 1)
    %call1 = tail call fastcc i32 @f(i32 47)
    %add3 = add nsw i32 %call, %call1
    ret i32 %add3
  }
  
  ; Function Attrs: noinline norecurse nounwind readnone uwtable
  define internal fastcc i32 @f(i32 %x) unnamed_addr #1 {
  entry:
    %c1 = icmp sle i32 %x, 100
  
    %cmp = icmp sgt i32 %x, 300
    %. = select i1 %cmp, i32 1, i32 2
    ret i32 %.
  }
  
  attributes #1 = { noinline }



Reviewers: davide, sanjoy, efriedma, dberlin

Reviewed By: davide, dberlin

Subscribers: mcrosier, gberry, mssimpso, dberlin, llvm-commits

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

llvm-svn: 315288
2017-10-10 09:32:38 +00:00
..
Analysis Convert an APInt to int64_t properly in TTI::getGEPCost(). 2017-10-04 20:47:33 +00:00
Assembler
Bindings
Bitcode Bitcode: add an auto-upgrade for LTO section name 2017-10-06 18:06:59 +00:00
BugPoint
CodeGen Fix for PR34888. 2017-10-10 08:46:10 +00:00
DebugInfo [dwarfdump] Verify that unit type matches root DIE 2017-10-06 22:27:31 +00:00
DllTool
Examples
ExecutionEngine Revert "Revert "ExecutionEngine: add R_AARCH64_ABS{16,32}"" 2017-09-20 21:32:44 +00:00
Feature
FileCheck
Instrumentation [MSan] Disable sanitization for __sanitizer_dtor_callback. 2017-09-20 22:53:08 +00:00
Integer
JitListener
LTO Move the stripping of invalid debug info from the Verifier to AutoUpgrade. 2017-10-02 18:31:29 +00:00
LibDriver
Linker llvm-dwarfdump: Make -brief the default and add a -verbose option instead. 2017-09-11 23:05:20 +00:00
MC [MC] Properly diagnose badly scoped .cfi_ directives 2017-10-10 01:49:21 +00:00
Object Added phdr upper bound checks to ElfObject. 2017-10-05 20:01:32 +00:00
ObjectYAML [ObjectYAML] Handle SHF_COMPRESSED 2017-10-03 06:35:55 +00:00
Other [NewPassManager] Run global dead code elimination after the inliner. 2017-10-05 18:36:01 +00:00
SafepointIRVerifier
SymbolRewriter
TableGen [globalisel] Add support for ValueType operands in patterns. 2017-10-09 18:14:53 +00:00
ThinLTO/X86 ModuleSummaryAnalysis: Correctly handle all function operand references. 2017-09-07 05:35:35 +00:00
Transforms [SCCP] Propagate integer range info for parameters in IPSCCP. 2017-10-10 09:32:38 +00:00
Unit [lit] Make lit support config files with .py extension. 2017-09-21 00:24:52 +00:00
Verifier Move the stripping of invalid debug info from the Verifier to AutoUpgrade. 2017-10-02 18:31:29 +00:00
YAMLParser
tools [MC] Suppress .Lcfi labels when emitting textual assembly 2017-10-10 00:57:36 +00:00
.clang-format
CMakeLists.txt [lit] Make lit support config files with .py extension. 2017-09-21 00:24:52 +00:00
TestRunner.sh
lit.cfg.py [lit] Improve tool substitution in lit. 2017-10-06 17:54:46 +00:00
lit.site.cfg.py.in [lit] Make lit support config files with .py extension. 2017-09-21 00:24:52 +00:00