1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00
llvm-mirror/lib/Transforms
Bruno Cardoso Lopes cc3be5ce55 Reintroduce "[SCCP] Propagate integer range info for parameters in IPSCCP."
This is r315288 & r315294, which were reverted due to stage2 bot
failures.

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: 315593
2017-10-12 16:54:11 +00:00
..
Coroutines [dump] Remove NDEBUG from test to enable dump methods [NFC] 2017-10-12 16:16:06 +00:00
Hello
InstCombine Renable r314928 2017-10-10 05:07:54 +00:00
Instrumentation [NFC] Convert OptimizationRemarkEmitter old emit() calls to new closure 2017-10-11 17:12:59 +00:00
IPO [NFC] Convert OptimizationRemarkEmitter old emit() calls to new closure 2017-10-11 17:12:59 +00:00
ObjCARC [ObjCARC] Pass the correct BasicBlock to fix assertion failure. 2017-08-31 18:27:47 +00:00
Scalar Reintroduce "[SCCP] Propagate integer range info for parameters in IPSCCP." 2017-10-12 16:54:11 +00:00
Utils [SimplifyIndVar] Replace IVUsers with loop invariant whenever possible 2017-10-12 02:54:11 +00:00
Vectorize [NFC] Convert OptimizationRemarkEmitter old emit() calls to new closure 2017-10-11 17:12:59 +00:00
CMakeLists.txt
LLVMBuild.txt