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.
This commit is contained in:
Matt Pharr
2012-04-18 10:26:22 -07:00
parent abf7c423bb
commit 645a8c9349

View File

@@ -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(),