llvm-6502/test/Transforms/JumpThreading/jump_threading.ll
Jiangning Liu 1505fa4376 In LVI(Lazy Value Info), originally value on a BB can only be caculated once,
and the lattice will be updated to be a state other than "undefined". This
limiation could miss some opportunities of lowering "overdefined" to be an
even accurate value. So this patch ask the algorithm to try to lower the
lattice value again even if the value has been lowered to be "overdefined".



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215343 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-11 05:02:04 +00:00

34 lines
872 B
LLVM

; RUN: opt < %s -jump-threading -S | FileCheck %s
define i32 @test_jump_threading(i32* %arg1, i32 %arg2) {
entry:
%cmp = icmp slt i32 %arg2, 0
br i1 %cmp, label %land.lhs.true, label %lor.rhs
land.lhs.true:
%ident = getelementptr inbounds i32 * %arg1, i64 0
%0 = load i32* %ident, align 4
%cmp1 = icmp eq i32 %0, 1
br i1 %cmp1, label %lor.end, label %lor.rhs
; CHECK: br i1 %cmp1, label %lor.end, label %lor.rhs.thread
; CHECK: lor.rhs.thread:
; CHECK-NEXT: br label %lor.end
lor.rhs:
%cmp2 = icmp sgt i32 %arg2, 0
br i1 %cmp2, label %land.rhs, label %lor.end
land.rhs:
%ident3 = getelementptr inbounds i32 * %arg1, i64 0
%1 = load i32* %ident3, align 4
%cmp4 = icmp eq i32 %1, 2
br label %lor.end
lor.end:
%2 = phi i1 [ true, %land.lhs.true ], [ false, %lor.rhs ], [ %cmp4, %land.rhs ]
%lor.ext = zext i1 %2 to i32
ret i32 %lor.ext
}