[PATCH] D85892: [SVE] Fix bug in SVEIntrinsicOpts::optimizePTest

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 13 23:57:49 PDT 2020


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6c7957c99017: [SVE] Fix bug in SVEIntrinsicOpts::optimizePTest (authored by david-arm).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85892/new/

https://reviews.llvm.org/D85892

Files:
  llvm/lib/Target/AArch64/SVEIntrinsicOpts.cpp
  llvm/test/CodeGen/AArch64/sve-intrinsic-opts-ptest.ll


Index: llvm/test/CodeGen/AArch64/sve-intrinsic-opts-ptest.ll
===================================================================
--- llvm/test/CodeGen/AArch64/sve-intrinsic-opts-ptest.ll
+++ llvm/test/CodeGen/AArch64/sve-intrinsic-opts-ptest.ll
@@ -44,6 +44,16 @@
   ret i1 %out
 }
 
+define i1 @ptest_first_same_ops(<vscale x 2 x i1> %a) {
+; OPT-LABEL: ptest_first_same_ops
+; OPT: %[[OUT:.*]] = call i1 @llvm.aarch64.sve.ptest.first.nxv2i1(<vscale x 2 x i1> %a, <vscale x 2 x i1> %a)
+; OPT-NOT: convert
+; OPT-NEXT: ret i1 %[[OUT]]
+  %1 = tail call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv2i1(<vscale x 2 x i1> %a)
+  %2 = tail call i1 @llvm.aarch64.sve.ptest.first.nxv16i1(<vscale x 16 x i1> %1, <vscale x 16 x i1> %1)
+  ret i1 %2
+}
+
 define i1 @ptest_last(<vscale x 8 x i1> %a) {
 ; OPT-LABEL: ptest_last
 ; OPT: %mask = tail call <vscale x 8 x i1> @llvm.aarch64.sve.ptrue.nxv8i1(i32 0)
Index: llvm/lib/Target/AArch64/SVEIntrinsicOpts.cpp
===================================================================
--- llvm/lib/Target/AArch64/SVEIntrinsicOpts.cpp
+++ llvm/lib/Target/AArch64/SVEIntrinsicOpts.cpp
@@ -160,7 +160,7 @@
     I->eraseFromParent();
     if (Op1->use_empty())
       Op1->eraseFromParent();
-    if (Op2->use_empty())
+    if (Op1 != Op2 && Op2->use_empty())
       Op2->eraseFromParent();
 
     return true;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85892.285562.patch
Type: text/x-patch
Size: 1357 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200814/e7d2f8fb/attachment.bin>


More information about the llvm-commits mailing list