From 645a8c9349d69b87c280300987c9869383eb88d3 Mon Sep 17 00:00:00 2001 From: Matt Pharr Date: Wed, 18 Apr 2012 10:26:22 -0700 Subject: [PATCH] Fix serious bug in VSelMovmskOpt When the mask was all off, we'd choose the incorrect operand! (This bug was masked since this optimization wasn't triggering as intended, due to other issues to be fixed in a forthcoming commit. --- opt.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/opt.cpp b/opt.cpp index 70649d39..5a7bffa4 100644 --- a/opt.cpp +++ b/opt.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2010-2011, Intel Corporation + Copyright (c) 2010-2012, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -899,8 +899,8 @@ VSelMovmskOpt::runOnBasicBlock(llvm::BasicBlock &bb) { // Mask all on -> replace with the first select value value = selectInst->getOperand(1); else if (mask == 0) - // Mask all off -> replace with the second select blend value - value = selectInst->getOperand(1); + // Mask all off -> replace with the second select value + value = selectInst->getOperand(2); if (value != NULL) { llvm::ReplaceInstWithValue(iter->getParent()->getInstList(),