From e864447e4a7a921b15bb3757be25afd577f9f7c6 Mon Sep 17 00:00:00 2001 From: Matt Pharr Date: Mon, 13 Feb 2012 12:06:45 -0800 Subject: [PATCH] Fix silly bug in vector scale extraction optimization. (Introduced in f20a2d2ee. How did this ever pass tests?) --- opt.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opt.cpp b/opt.cpp index f46415a3..ac0b9c53 100644 --- a/opt.cpp +++ b/opt.cpp @@ -1443,7 +1443,7 @@ lExtract248Scale(llvm::Value *splatOperand, int splatValue, Assert(insertBefore != NULL); if ((splatValue % scale) == 0) { - // *result = otherOperand + splatOperand / splatValue; + // *result = otherOperand * splatOperand / scale; llvm::Value *splatScaleVec = (splatOperand->getType() == LLVMTypes::Int32VectorType) ? LLVMInt32Vector(scale) : LLVMInt64Vector(scale); @@ -1452,7 +1452,7 @@ lExtract248Scale(llvm::Value *splatOperand, int splatValue, splatOperand, splatScaleVec, "div", insertBefore); *result = - llvm::BinaryOperator::Create(llvm::Instruction::Add, + llvm::BinaryOperator::Create(llvm::Instruction::Mul, splatDiv, otherOperand, "add", insertBefore); return LLVMInt32(scale);