[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.

llvm-svn: 345043
This commit is contained in:
Sanjay Patel 2018-10-23 16:05:09 +00:00
parent 5b6b090cf2
commit 47a52a0521
1 changed files with 6 additions and 2 deletions

View File

@ -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;