From c924df94b9c9dee68d65dfacde0888748c16dc1f Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Tue, 23 Oct 2018 16:05:09 +0000 Subject: [PATCH] [WebAssembly] use 'match' to simplify code; NFC Vector types are not possible here because this code explicitly checks for a scalar type, but this is another step towards completely removing the fake binop queries for not/neg/fneg. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@345043 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/WebAssembly/WebAssemblyFastISel.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/Target/WebAssembly/WebAssemblyFastISel.cpp b/lib/Target/WebAssembly/WebAssemblyFastISel.cpp index 0be4f228347..5611a1b4588 100644 --- a/lib/Target/WebAssembly/WebAssemblyFastISel.cpp +++ b/lib/Target/WebAssembly/WebAssemblyFastISel.cpp @@ -37,7 +37,10 @@ #include "llvm/IR/Instructions.h" #include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/Operator.h" +#include "llvm/IR/PatternMatch.h" + using namespace llvm; +using namespace PatternMatch; #define DEBUG_TYPE "wasm-fastisel" @@ -417,9 +420,10 @@ unsigned WebAssemblyFastISel::getRegForI1Value(const Value *V, bool &Not) { return getRegForValue(ICmp->getOperand(0)); } - if (BinaryOperator::isNot(V) && V->getType()->isIntegerTy(32)) { + Value *NotV; + if (match(V, m_Not(m_Value(NotV))) && V->getType()->isIntegerTy(32)) { Not = true; - return getRegForValue(BinaryOperator::getNotArgument(V)); + return getRegForValue(NotV); } Not = false; -- 2.11.0