llvm.org GIT mirror llvm / 421cc4c
Add a micro-test for the transforms I added to JumpThreading. I have not been able to find a way to test each in isolation, for a few reasons: 1) The ability to look-through non-i1 BinaryOperator's requires the ability to look through non-constant ICmps in order for it to ever trigger. 2) The ability to do LVI-powered PHI value determination only matters in cases that ProcessBranchOnPHI can't handle. Since it already handles all the cases without other instructions in the def-use chain between the PHI and the branch, it requires the ability to look through ICmps and/or BinaryOperators as well. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112611 91177308-0d34-0410-b5e6-96231b3b80d8 Owen Anderson 9 years ago
1 changed file(s) with 31 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
420420 ; CHECK-NEXT: br i1 %N, label %T2, label %F2
421421 }
422422
423
423 ; CHECK: @test14
424 define i32 @test14(i32 %in) {
425 entry:
426 %A = icmp eq i32 %in, 0
427 ; CHECK: br i1 %A, label %right_ret, label %merge
428 br i1 %A, label %left, label %right
429
430 ; CHECK-NOT: left:
431 left:
432 br label %merge
433
434 ; CHECK-NOT: right:
435 right:
436 %B = call i32 @f1()
437 br label %merge
438
439 merge:
440 ; CHECK-NOT: %C = phi i32 [%in, %left], [%B, %right]
441 %C = phi i32 [%in, %left], [%B, %right]
442 %D = add i32 %C, 1
443 %E = icmp eq i32 %D, 2
444 br i1 %E, label %left_ret, label %right_ret
445
446 ; CHECK: left_ret:
447 left_ret:
448 ret i32 0
449
450 right_ret:
451 ret i32 1
452 }
453