[llvm] r302022 - [SystemZ] Properly check number of operands in getCmpOpsType()
Jonas Paulsson via llvm-commits
llvm-commits at lists.llvm.org
Wed May 3 06:33:46 PDT 2017
Author: jonpa
Date: Wed May 3 08:33:45 2017
New Revision: 302022
URL: http://llvm.org/viewvc/llvm-project?rev=302022&view=rev
Log:
[SystemZ] Properly check number of operands in getCmpOpsType()
It is needed to check that the number of operands are 2 when
finding the case of a logic combination, e.g. 'and' of two compares.
Review: Ulrich Weigand
Modified:
llvm/trunk/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp
Modified: llvm/trunk/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp?rev=302022&r1=302021&r2=302022&view=diff
==============================================================================
--- llvm/trunk/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp (original)
+++ llvm/trunk/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp Wed May 3 08:33:45 2017
@@ -530,9 +530,10 @@ static Type *getCmpOpsType(const Instruc
if (CmpInst *CI = dyn_cast<CmpInst>(I->getOperand(0)))
OpTy = CI->getOperand(0)->getType();
else if (Instruction *LogicI = dyn_cast<Instruction>(I->getOperand(0)))
- if (CmpInst *CI0 = dyn_cast<CmpInst>(LogicI->getOperand(0)))
- if (isa<CmpInst>(LogicI->getOperand(1)))
- OpTy = CI0->getOperand(0)->getType();
+ if (LogicI->getNumOperands() == 2)
+ if (CmpInst *CI0 = dyn_cast<CmpInst>(LogicI->getOperand(0)))
+ if (isa<CmpInst>(LogicI->getOperand(1)))
+ OpTy = CI0->getOperand(0)->getType();
if (OpTy != nullptr) {
if (VF == 1) {
More information about the llvm-commits
mailing list