Scalar target fixes.

Don't issue warnings about all instances writing to the same location if
there is only one program instance in the gang.

Be sure to report that all values are equal in one-element vectors in
LLVMVectorValuesAllEqual().

Issue #166.
This commit is contained in:
Matt Pharr
2012-01-31 08:52:11 -08:00
parent 950f86200b
commit 1eec27f890
2 changed files with 14 additions and 7 deletions

View File

@@ -597,6 +597,9 @@ LLVMFlattenInsertChain(llvm::InsertElementInst *ie, int vectorWidth,
bool
LLVMVectorValuesAllEqual(llvm::Value *v, int vectorLength,
std::vector<llvm::PHINode *> &seenPhis) {
if (vectorLength == 1)
return true;
if (llvm::isa<llvm::ConstantAggregateZero>(v))
return true;

18
opt.cpp
View File

@@ -2515,10 +2515,12 @@ GSToLoadStorePass::runOnBasicBlock(llvm::BasicBlock &bb) {
}
else {
// A scatter with everyone going to the same location is
// undefined. Issue a warning and arbitrarily let the
// undefined (if there's more than one program instance in
// the gang). Issue a warning and arbitrarily let the
// first guy win.
Warning(pos, "Undefined behavior: all program instances are "
"writing to the same location!");
if (g->target.vectorWidth > 1)
Warning(pos, "Undefined behavior: all program instances are "
"writing to the same location!");
llvm::Value *first =
llvm::ExtractElementInst::Create(storeValue, LLVMInt32(0), "rvalue_first",
@@ -2694,10 +2696,12 @@ PseudoGSToGSPass::runOnBasicBlock(llvm::BasicBlock &bb) {
Assert(ok);
callInst->setCalledFunction(info->actualFunc);
if (info->isGather)
PerformanceWarning(pos, "Gather required to compute value in expression.");
else
PerformanceWarning(pos, "Scatter required for storing value.");
if (g->target.vectorWidth > 1) {
if (info->isGather)
PerformanceWarning(pos, "Gather required to compute value in expression.");
else
PerformanceWarning(pos, "Scatter required for storing value.");
}
modifiedAny = true;
goto restart;
}