LLVMVectorValuesAllEqual() improvements.

Clean up the API, so the caller doesn't have to pass in a vector so
the function can track PHI nodes (do that internally instead.)

Handle casts in lValuesAreEqual().
This commit is contained in:
Matt Pharr
2012-03-19 11:54:18 -07:00
parent 0664f5a724
commit e264d95019
4 changed files with 53 additions and 26 deletions

13
opt.cpp
View File

@@ -1562,8 +1562,7 @@ lExtractUniforms(llvm::Value **vec, llvm::Instruction *insertBefore) {
return unif;
}
std::vector<llvm::PHINode *> phis;
if (LLVMVectorValuesAllEqual(*vec, g->target.vectorWidth, phis)) {
if (LLVMVectorValuesAllEqual(*vec)) {
// FIXME: we may want to redo all of the expression here, in scalar
// form (if at all possible), for code quality...
llvm::Value *unif =
@@ -2619,8 +2618,10 @@ GSToLoadStorePass::runOnBasicBlock(llvm::BasicBlock &bb) {
constOffsets, "varying+const_offsets",
callInst);
std::vector<llvm::PHINode *> seenPhis;
if (LLVMVectorValuesAllEqual(fullOffsets, g->target.vectorWidth, seenPhis)) {
Debug(SourcePos(), "GSToLoadStore: %s.",
fullOffsets->getName().str().c_str());
if (LLVMVectorValuesAllEqual(fullOffsets)) {
// If all the offsets are equal, then compute the single
// pointer they all represent based on the first one of them
// (arbitrarily).
@@ -3688,9 +3689,7 @@ GatherCoalescePass::runOnBasicBlock(llvm::BasicBlock &bb) {
if (lIsMaskAllOn(mask) == false)
continue;
std::vector<llvm::PHINode *> seenPhis;
if (LLVMVectorValuesAllEqual(variableOffsets, g->target.vectorWidth,
seenPhis) == false)
if (!LLVMVectorValuesAllEqual(variableOffsets))
continue;
// coalesceGroup stores the set of gathers that we're going to try to