[PATCH] D15210: [WebAssembly] Fix dominance check for PHIs in the StoreResult pass

Derek Schuff via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 3 14:55:02 PST 2015


dschuff accepted this revision.
dschuff added a comment.
This revision is now accepted and ready to land.

otherwise LGTM


================
Comment at: lib/Target/WebAssembly/WebAssemblyStoreResults.cpp:95
@@ +94,3 @@
+            // is used.
+            MachineBasicBlock *Pred = Where->getOperand(&O - &Where->getOperand(0) + 1).getMBB();
+            if (!MDT.dominates(&MBB, Pred))
----------------
I don't really understand what this arithmetic on the MachineOperands actually means.
I guess it's just trying to find which operand on Where is the use of MI.

Actually there's also nothing that explicitly says what the pass even does.
IIUC we are attempting to find uses of the stored value and make them uses of the result of the store instead (which we can do if the store dominates the use), so maybe it should say that somewhere.

================
Comment at: test/CodeGen/WebAssembly/store-results.ll:26
@@ +25,3 @@
+
+; CHECK-LABEL: foo:
+; CHECK: i32.store $discard=, $pop0, $0
----------------
could this maybe say what the nature of the corner case is for each of these functions?


Repository:
  rL LLVM

http://reviews.llvm.org/D15210





More information about the llvm-commits mailing list