Mercurial > hg > CbC > CbC_llvm
diff lib/Target/X86/X86FixupSetCC.cpp @ 148:63bd29f05246
merged
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 14 Aug 2019 19:46:37 +0900 |
parents | c2174574ed3a |
children |
line wrap: on
line diff
--- a/lib/Target/X86/X86FixupSetCC.cpp Sun Dec 23 19:23:36 2018 +0900 +++ b/lib/Target/X86/X86FixupSetCC.cpp Wed Aug 14 19:46:37 2019 +0900 @@ -1,9 +1,8 @@ //===---- X86FixupSetCC.cpp - optimize usage of LEA instructions ----------===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // @@ -68,30 +67,6 @@ FunctionPass *llvm::createX86FixupSetCC() { return new X86FixupSetCCPass(); } -bool X86FixupSetCCPass::isSetCCr(unsigned Opcode) { - switch (Opcode) { - default: - return false; - case X86::SETOr: - case X86::SETNOr: - case X86::SETBr: - case X86::SETAEr: - case X86::SETEr: - case X86::SETNEr: - case X86::SETBEr: - case X86::SETAr: - case X86::SETSr: - case X86::SETNSr: - case X86::SETPr: - case X86::SETNPr: - case X86::SETLr: - case X86::SETGEr: - case X86::SETLEr: - case X86::SETGr: - return true; - } -} - // We expect the instruction *immediately* before the setcc to imp-def // EFLAGS (because of scheduling glue). To make this less brittle w.r.t // scheduling, look backwards until we hit the beginning of the @@ -103,7 +78,7 @@ auto MBBStart = MBB->rend(); for (int i = 0; (i < SearchBound) && (MI != MBBStart); ++i, ++MI) for (auto &Op : MI->implicit_operands()) - if ((Op.getReg() == X86::EFLAGS) && (Op.isDef())) + if (Op.isReg() && (Op.getReg() == X86::EFLAGS) && Op.isDef()) return &*MI; return nullptr; @@ -111,7 +86,7 @@ bool X86FixupSetCCPass::impUsesFlags(MachineInstr *MI) { for (auto &Op : MI->implicit_operands()) - if ((Op.getReg() == X86::EFLAGS) && (Op.isUse())) + if (Op.isReg() && (Op.getReg() == X86::EFLAGS) && Op.isUse()) return true; return false; @@ -129,7 +104,7 @@ // Find a setcc that is used by a zext. // This doesn't have to be the only use, the transformation is safe // regardless. - if (!isSetCCr(MI.getOpcode())) + if (MI.getOpcode() != X86::SETCCr) continue; MachineInstr *ZExt = nullptr;