[PATCH] D21775: [InstCombine] Simplify and correct folding fcmps with the same children
Tim Shen via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 29 03:15:39 PDT 2016
timshen updated this revision to Diff 62196.
timshen added a comment.
Updated comments, and move the changed (perfectly handled actually) solution before other heuristics. The move catches two more optimizations, see a local diff:
diff --git a/test/Transforms/InstCombine/and-fcmp.ll b/test/Transforms/InstCombine/and-fcmp.ll
index 8ad6779..fa9e441 100644
- a/test/Transforms/InstCombine/and-fcmp.ll
+++ b/test/Transforms/InstCombine/and-fcmp.ll
@@ -546,10 +546,8 @@ bb:
define i1 @auto_gen_35(double %a, double %b) {
; CHECK-LABEL: @auto_gen_35(
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[CMP:%.*]] = fcmp ord double %a, %b
-; CHECK-NEXT: [[CMP1:%.*]] = fcmp ord double %a, %b
-; CHECK-NEXT: [[RETVAL:%.*]] = and i1 [[CMP]], [[CMP1]]
-; CHECK-NEXT: ret i1 [[RETVAL]]
+; CHECK-NEXT: [[TMP0:%.*]] = fcmp ord double %a, %b
+; CHECK-NEXT: ret i1 [[TMP0]]
;
bb:
%cmp = fcmp ord double %a, %b
diff --git a/test/Transforms/InstCombine/or-fcmp.ll b/test/Transforms/InstCombine/or-fcmp.ll
index f961cfa..9d743c7 100644
- a/test/Transforms/InstCombine/or-fcmp.ll
+++ b/test/Transforms/InstCombine/or-fcmp.ll
@@ -1579,10 +1579,8 @@ bb:
define i1 @auto_gen_119(double %a, double %b) {
; CHECK-LABEL: @auto_gen_119(
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[CMP:%.*]] = fcmp uno double %a, %b
-; CHECK-NEXT: [[CMP1:%.*]] = fcmp uno double %a, %b
-; CHECK-NEXT: [[RETVAL:%.*]] = or i1 [[CMP]], [[CMP1]]
-; CHECK-NEXT: ret i1 [[RETVAL]]
+; CHECK-NEXT: [[TMP0:%.*]] = fcmp uno double %a, %b
+; CHECK-NEXT: ret i1 [[TMP0]]
;
bb:
%cmp = fcmp uno double %a, %b
http://reviews.llvm.org/D21775
Files:
lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
test/Transforms/InstCombine/and-fcmp.ll
test/Transforms/InstCombine/or-fcmp.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21775.62196.patch
Type: text/x-patch
Size: 95093 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160629/1782a90c/attachment.bin>
More information about the llvm-commits
mailing list