mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
[SelectionDAGBuilder] Simplify the struct type handling in getUniformBase.
This commit is contained in:
parent
68f278abc5
commit
8a39768ac7
@ -4424,16 +4424,9 @@ static bool getUniformBase(const Value *&Ptr, SDValue &Base, SDValue &Index,
|
||||
|
||||
if (STy) {
|
||||
const StructLayout *SL = DL.getStructLayout(STy);
|
||||
if (isa<VectorType>(C->getType())) {
|
||||
C = C->getSplatValue();
|
||||
// FIXME: If getSplatValue may return nullptr for a structure?
|
||||
// If not, the following check can be removed.
|
||||
if (!C)
|
||||
return false;
|
||||
}
|
||||
auto *CI = cast<ConstantInt>(C);
|
||||
unsigned Field = cast<Constant>(IndexVal)->getUniqueInteger().getZExtValue();
|
||||
Scale = DAG.getTargetConstant(1, SDB->getCurSDLoc(), TLI.getPointerTy(DL));
|
||||
Index = DAG.getConstant(SL->getElementOffset(CI->getZExtValue()),
|
||||
Index = DAG.getConstant(SL->getElementOffset(Field),
|
||||
SDB->getCurSDLoc(), TLI.getPointerTy(DL));
|
||||
} else {
|
||||
Scale = DAG.getTargetConstant(
|
||||
|
Loading…
Reference in New Issue
Block a user