summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2016-04-05 21:10:45 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2016-04-05 21:10:45 +0000
commit1de3c7e79010c43300a2637c3020a1489a3dd0de (patch)
tree637d041245eb1fc7fee37ea9b5a5d14e9911e5f6 /llvm/lib/Target
parentf880d35b80dd7fda9ddfffeff7383614318b1bdb (diff)
downloadbcm5719-llvm-1de3c7e79010c43300a2637c3020a1489a3dd0de.tar.gz
bcm5719-llvm-1de3c7e79010c43300a2637c3020a1489a3dd0de.zip
IR: Introduce ConstantAggregate, NFC
Add a common parent class for ConstantArray, ConstantVector, and ConstantStruct called ConstantAggregate. These are the aggregate subclasses of Constant that take operands. This is mainly a cleanup, adding common `isa` target and removing duplicated code. However, it also simplifies caching which constants point transitively at `GlobalValue` (a possible future direction). llvm-svn: 265466
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp3
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXGenericToNVVM.cpp3
2 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
index c084b48fdc4..fe816ebb68e 100644
--- a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
@@ -1910,8 +1910,7 @@ void NVPTXAsmPrinter::bufferLEByte(const Constant *CPV, int Bytes,
case Type::ArrayTyID:
case Type::VectorTyID:
case Type::StructTyID: {
- if (isa<ConstantArray>(CPV) || isa<ConstantVector>(CPV) ||
- isa<ConstantStruct>(CPV) || isa<ConstantDataSequential>(CPV)) {
+ if (isa<ConstantAggregate>(CPV) || isa<ConstantDataSequential>(CPV)) {
int ElementSize = DL.getTypeAllocSize(CPV->getType());
bufferAggregateConstant(CPV, aggBuffer);
if (Bytes > ElementSize)
diff --git a/llvm/lib/Target/NVPTX/NVPTXGenericToNVVM.cpp b/llvm/lib/Target/NVPTX/NVPTXGenericToNVVM.cpp
index 5ace765f260..af418f0e3da 100644
--- a/llvm/lib/Target/NVPTX/NVPTXGenericToNVVM.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXGenericToNVVM.cpp
@@ -230,8 +230,7 @@ Value *GenericToNVVM::remapConstant(Module *M, Function *F, Constant *C,
if (I != GVMap.end()) {
NewValue = getOrInsertCVTA(M, F, I->second, Builder);
}
- } else if (isa<ConstantVector>(C) || isa<ConstantArray>(C) ||
- isa<ConstantStruct>(C)) {
+ } else if (isa<ConstantAggregate>(C)) {
// If any element in the constant vector or aggregate C is or uses a global
// variable in GVMap, the constant C needs to be reconstructed, using a set
// of instructions.
OpenPOWER on IntegriCloud