[llvm] r269681 - [WebAssembly] Use eqz to negate a branch conditions.
Dan Gohman via llvm-commits
llvm-commits at lists.llvm.org
Mon May 16 11:59:34 PDT 2016
Author: djg
Date: Mon May 16 13:59:34 2016
New Revision: 269681
URL: http://llvm.org/viewvc/llvm-project?rev=269681&view=rev
Log:
[WebAssembly] Use eqz to negate a branch conditions.
Modified:
llvm/trunk/lib/Target/WebAssembly/WebAssemblyLowerBrUnless.cpp
llvm/trunk/test/CodeGen/WebAssembly/cfg-stackify.ll
Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyLowerBrUnless.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyLowerBrUnless.cpp?rev=269681&r1=269680&r2=269681&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyLowerBrUnless.cpp (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyLowerBrUnless.cpp Mon May 16 13:59:34 2016
@@ -106,16 +106,10 @@ bool WebAssemblyLowerBrUnless::runOnMach
// If we weren't able to invert the condition in place. Insert an
// expression to invert it.
if (!Inverted) {
- unsigned ZeroReg = MRI.createVirtualRegister(&WebAssembly::I32RegClass);
- MFI.stackifyVReg(ZeroReg);
- BuildMI(MBB, MI, MI->getDebugLoc(), TII.get(WebAssembly::CONST_I32),
- ZeroReg)
- .addImm(0);
unsigned Tmp = MRI.createVirtualRegister(&WebAssembly::I32RegClass);
MFI.stackifyVReg(Tmp);
- BuildMI(MBB, MI, MI->getDebugLoc(), TII.get(WebAssembly::EQ_I32), Tmp)
- .addReg(Cond)
- .addReg(ZeroReg);
+ BuildMI(MBB, MI, MI->getDebugLoc(), TII.get(WebAssembly::EQZ_I32), Tmp)
+ .addReg(Cond);
Cond = Tmp;
Inverted = true;
}
Modified: llvm/trunk/test/CodeGen/WebAssembly/cfg-stackify.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WebAssembly/cfg-stackify.ll?rev=269681&r1=269680&r2=269681&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/WebAssembly/cfg-stackify.ll (original)
+++ llvm/trunk/test/CodeGen/WebAssembly/cfg-stackify.ll Mon May 16 13:59:34 2016
@@ -1261,8 +1261,7 @@ bb50:
; OPT: block
; OPT: block
; OPT-NEXT: i32.const $push
-; OPT-NEXT: i32.const $push
-; OPT-NEXT: i32.eq $push{{.*}}=, $pop{{.*}}, $pop{{.*}}{{$}}
+; OPT-NEXT: i32.eqz $push{{.*}}=, $pop{{.*}}{{$}}
; OPT-NEXT: br_if 0, $pop{{.*}}{{$}}
; OPT-NEXT: call test15_callee1 at FUNCTION{{$}}
; OPT-NEXT: br 1{{$}}
More information about the llvm-commits
mailing list