aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2014-08-22 18:49:31 +0000
committerTom Stellard <thomas.stellard@amd.com>2014-08-22 18:49:31 +0000
commitca7ecf3dfac3efd68ece30bd6d81e746fa5f4d96 (patch)
treeb9b52e09e50787fe78b2b20d0fdacaefe5d3cc26 /llvm/lib
parent0510514e36cb03f7668db0fb9cc9c948af304ca6 (diff)
downloadllvm-ca7ecf3dfac3efd68ece30bd6d81e746fa5f4d96.zip
llvm-ca7ecf3dfac3efd68ece30bd6d81e746fa5f4d96.tar.gz
llvm-ca7ecf3dfac3efd68ece30bd6d81e746fa5f4d96.tar.bz2
R600/SI: Wrap local memory pointer in AssertZExt on SI
These pointers are really just offsets and they will always be less than 16-bits. Using AssertZExt allows us to use computeKnownBits to prove that these values are positive. We will use this information in a later commit. llvm-svn: 216277
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/R600/SIISelLowering.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/Target/R600/SIISelLowering.cpp b/llvm/lib/Target/R600/SIISelLowering.cpp
index ec259f1..67f566f 100644
--- a/llvm/lib/Target/R600/SIISelLowering.cpp
+++ b/llvm/lib/Target/R600/SIISelLowering.cpp
@@ -504,6 +504,18 @@ SDValue SITargetLowering::LowerFormalArguments(
SDValue Arg = LowerParameter(DAG, VT, MemVT, DL, DAG.getRoot(),
36 + VA.getLocMemOffset(),
Ins[i].Flags.isSExt());
+
+ const PointerType *ParamTy =
+ dyn_cast<PointerType>(FType->getParamType(Ins[i].OrigArgIndex));
+ if (Subtarget->getGeneration() == AMDGPUSubtarget::SOUTHERN_ISLANDS &&
+ ParamTy && ParamTy->getAddressSpace() == AMDGPUAS::LOCAL_ADDRESS) {
+ // On SI local pointers are just offsets into LDS, so they are always
+ // less than 16-bits. On CI and newer they could potentially be
+ // real pointers, so we can't guarantee their size.
+ Arg = DAG.getNode(ISD::AssertZext, DL, Arg.getValueType(), Arg,
+ DAG.getValueType(MVT::i16));
+ }
+
InVals.push_back(Arg);
continue;
}