[PATCH] D80140: [x86] Propagate memory operands during ISel DAG postprocessing

Jean-Michel Gorius via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 18 13:01:20 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGcd12e79e6ddd: [x86] Propagate memory operands during ISel DAG postprocessing (authored by Kayjukh).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80140

Files:
  llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
  llvm/test/CodeGen/X86/isel-postprocessing-test-fold-memop.ll


Index: llvm/test/CodeGen/X86/isel-postprocessing-test-fold-memop.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/X86/isel-postprocessing-test-fold-memop.ll
@@ -0,0 +1,14 @@
+; RUN: llc -O2 -mtriple=x86_64-- -stop-after=finalize-isel < %s | FileCheck %s
+
+define i1 @fold_test(i64* %x, i64 %l) {
+entry:
+  %0 = load i64, i64* %x, align 8
+  %and = and i64 %0, %l
+  %tobool = icmp ne i64 %and, 0
+  ret i1 %tobool
+
+  ; Folding the load+and+icmp instructions into a TEST64mr instruction
+  ; should preserve memory operands.
+  ; CHECK: TEST64mr {{.*}} :: (load 8 from {{%.*}})
+}
+
Index: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
===================================================================
--- llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
+++ llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
@@ -1388,6 +1388,8 @@
                           And.getOperand(6)  /* Chain */ };
         MachineSDNode *Test = CurDAG->getMachineNode(NewOpc, SDLoc(N),
                                                      MVT::i32, MVT::Other, Ops);
+        CurDAG->setNodeMemRefs(
+            Test, cast<MachineSDNode>(And.getNode())->memoperands());
         ReplaceUses(N, Test);
         MadeChange = true;
         continue;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80140.264704.patch
Type: text/x-patch
Size: 1266 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200518/a6a1b241/attachment.bin>


More information about the llvm-commits mailing list