summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2017-02-01 00:08:53 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2017-02-01 00:08:53 +0000
commitbdd59e68799c6fec87a26c459bc0541b15be9bfc (patch)
treebaea7172f202d5dc5be39eaf0ba68e34486f42ed /llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
parent5c76e3d0342c2f2e33eae83465c7fff79866e60e (diff)
downloadbcm5719-llvm-bdd59e68799c6fec87a26c459bc0541b15be9bfc.tar.gz
bcm5719-llvm-bdd59e68799c6fec87a26c459bc0541b15be9bfc.zip
InferAddressSpaces: Handle select
This fails to handle some cases where one of the inputs is a constant to be fixed in a later commit. llvm-svn: 293723
Diffstat (limited to 'llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp b/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
index d3baeea2433..681fe717884 100644
--- a/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
+++ b/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
@@ -193,6 +193,7 @@ static bool isAddressExpression(const Value &V) {
case Instruction::BitCast:
case Instruction::AddrSpaceCast:
case Instruction::GetElementPtr:
+ case Instruction::Select:
return true;
default:
return false;
@@ -215,6 +216,8 @@ static SmallVector<Value *, 2> getPointerOperands(const Value &V) {
case Instruction::AddrSpaceCast:
case Instruction::GetElementPtr:
return {Op.getOperand(0)};
+ case Instruction::Select:
+ return {Op.getOperand(1), Op.getOperand(2)};
default:
llvm_unreachable("Unexpected instruction type.");
}
@@ -412,6 +415,11 @@ static Value *cloneInstructionWithNewAddressSpace(
NewGEP->setIsInBounds(GEP->isInBounds());
return NewGEP;
}
+ case Instruction::Select: {
+ assert(I->getType()->isPointerTy());
+ return SelectInst::Create(I->getOperand(0), NewPointerOperands[1],
+ NewPointerOperands[2], "", nullptr, I);
+ }
default:
llvm_unreachable("Unexpected opcode");
}
OpenPOWER on IntegriCloud