[llvm] r254570 - [WebAssembly] Add a test for wasm-store-results pass
Derek Schuff via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 2 16:50:30 PST 2015
Author: dschuff
Date: Wed Dec 2 18:50:30 2015
New Revision: 254570
URL: http://llvm.org/viewvc/llvm-project?rev=254570&view=rev
Log:
[WebAssembly] Add a test for wasm-store-results pass
Differential Revision: http://reviews.llvm.org/D15167
Added:
llvm/trunk/test/CodeGen/WebAssembly/store-results.ll
Modified:
llvm/trunk/lib/Target/WebAssembly/WebAssemblyStoreResults.cpp
Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyStoreResults.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyStoreResults.cpp?rev=254570&r1=254569&r2=254570&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyStoreResults.cpp (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyStoreResults.cpp Wed Dec 2 18:50:30 2015
@@ -69,7 +69,8 @@ bool WebAssemblyStoreResults::runOnMachi
const MachineRegisterInfo &MRI = MF.getRegInfo();
MachineDominatorTree &MDT = getAnalysis<MachineDominatorTree>();
- for (auto &MBB : MF)
+ for (auto &MBB : MF) {
+ DEBUG(dbgs() << "Basic Block: " << MBB.getName() << '\n');
for (auto &MI : MBB)
switch (MI.getOpcode()) {
default:
@@ -94,9 +95,12 @@ bool WebAssemblyStoreResults::runOnMachi
->getFirstTerminator();
if (&MI == Where || !MDT.dominates(&MI, Where))
continue;
+ DEBUG(dbgs() << "Setting operand " << O << " in " << *Where <<
+ " from " << MI <<"\n");
O.setReg(ToReg);
}
}
+ }
return true;
}
Added: llvm/trunk/test/CodeGen/WebAssembly/store-results.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WebAssembly/store-results.ll?rev=254570&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/WebAssembly/store-results.ll (added)
+++ llvm/trunk/test/CodeGen/WebAssembly/store-results.ll Wed Dec 2 18:50:30 2015
@@ -0,0 +1,18 @@
+; RUN: llc < %s -asm-verbose=false | FileCheck %s
+
+; Test that the wasm-store-results pass makes users of stored values use the
+; result of store expressions to reduce get_local/set_local traffic.
+
+target datalayout = "e-p:32:32-i64:64-n32:64-S128"
+target triple = "wasm32-unknown-unknown"
+
+; CHECK-LABEL: single_block:
+; CHECK-NOT: .local
+; CHECK: i32.const $push{{[0-9]+}}=, 0
+; CHECK: i32.store $push[[STORE:[0-9]+]]=, $0, $pop{{[0-9]+}}
+; CHECK: return $pop[[STORE]]{{$}}
+define i32 @single_block(i32* %p) {
+entry:
+ store i32 0, i32* %p
+ ret i32 0
+}
More information about the llvm-commits
mailing list