[PATCH] D152529: [NewGVN] Fold equivalent freeze instructions
Jay Foad via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 9 07:41:15 PDT 2023
foad updated this revision to Diff 529967.
foad added a comment.
Rebase on fixed test case.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152529/new/
https://reviews.llvm.org/D152529
Files:
llvm/lib/Transforms/Scalar/NewGVN.cpp
llvm/test/Transforms/NewGVN/freeze.ll
Index: llvm/test/Transforms/NewGVN/freeze.ll
===================================================================
--- llvm/test/Transforms/NewGVN/freeze.ll
+++ llvm/test/Transforms/NewGVN/freeze.ll
@@ -4,9 +4,7 @@
define i1 @f(i1 %a) {
; CHECK-LABEL: @f(
; CHECK-NEXT: [[B:%.*]] = freeze i1 [[A:%.*]]
-; CHECK-NEXT: [[C:%.*]] = freeze i1 [[A]]
-; CHECK-NEXT: [[D:%.*]] = and i1 [[B]], [[C]]
-; CHECK-NEXT: ret i1 [[D]]
+; CHECK-NEXT: ret i1 [[B]]
;
%b = freeze i1 %a
%c = freeze i1 %a
@@ -17,10 +15,9 @@
define void @f_multipleuses(i1 %a) {
; CHECK-LABEL: @f_multipleuses(
; CHECK-NEXT: [[B:%.*]] = freeze i1 [[A:%.*]]
-; CHECK-NEXT: [[C:%.*]] = freeze i1 [[A]]
; CHECK-NEXT: call void @use1(i1 [[B]])
-; CHECK-NEXT: call void @use1(i1 [[C]])
-; CHECK-NEXT: call void @use1(i1 [[C]])
+; CHECK-NEXT: call void @use1(i1 [[B]])
+; CHECK-NEXT: call void @use1(i1 [[B]])
; CHECK-NEXT: ret void
;
%b = freeze i1 %a
Index: llvm/lib/Transforms/Scalar/NewGVN.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/NewGVN.cpp
+++ llvm/lib/Transforms/Scalar/NewGVN.cpp
@@ -1994,6 +1994,7 @@
break;
case Instruction::BitCast:
case Instruction::AddrSpaceCast:
+ case Instruction::Freeze:
return createExpression(I);
break;
case Instruction::ICmp:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152529.529967.patch
Type: text/x-patch
Size: 1378 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230609/7202231c/attachment.bin>
More information about the llvm-commits
mailing list