forked from llvm-mirror/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove dead instructions before Redoing
Before reevaluating instructions, iterate over all instructions to be reevaluated and remove trivially dead instructions and if any of it's operands become trivially dead, mark it for deletion until all trivially dead instructions have been removed git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256773 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
Aditya Nandakumar
committed
Jan 4, 2016
1 parent
8c5b0b1
commit 3c91dc3
Showing
3 changed files
with
68 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
; RUN: opt -S -reassociate < %s | FileCheck %s | ||
|
||
; CHECK-LABEL: main | ||
; CHECK: %2 = fsub | ||
; CHECK: %3 = fsub | ||
; CHECK: fadd fast float %3, %2 | ||
define void @main(float, float) { | ||
wrapper_entry: | ||
%2 = fsub float undef, %0 | ||
%3 = fsub float undef, %1 | ||
%4 = call float @llvm.rsqrt.f32(float undef) | ||
%5 = fmul fast float undef, %4 | ||
%6 = fmul fast float %2, %4 | ||
%7 = fmul fast float %3, %4 | ||
%8 = fmul fast float %5, undef | ||
%9 = fmul fast float %6, undef | ||
%10 = fmul fast float %7, undef | ||
%11 = fadd fast float %8, %9 | ||
%12 = fadd fast float %11, %10 | ||
%13 = call float @foo2(float %12, float 0.000000e+00) | ||
%mul36 = fmul fast float %13, 1.500000e+00 | ||
call void @foo1(i32 4, float %mul36) | ||
ret void | ||
} | ||
|
||
declare void @foo1(i32, float) | ||
|
||
declare float @foo2(float, float) #1 | ||
|
||
declare float @llvm.rsqrt.f32(float) #1 | ||
|
||
attributes #0 = { argmemonly nounwind } | ||
attributes #1 = { nounwind readnone } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters