[llvm] r213104 - X86: Simplify X86WindowsTargetObjectFile::getSectionForConstant
David Majnemer
david.majnemer at gmail.com
Tue Jul 15 16:01:13 PDT 2014
Author: majnemer
Date: Tue Jul 15 18:01:10 2014
New Revision: 213104
URL: http://llvm.org/viewvc/llvm-project?rev=213104&view=rev
Log:
X86: Simplify X86WindowsTargetObjectFile::getSectionForConstant
There exists a helper function to abstract away the various differences
between ConstantVector, ConstantDataVector, ConstantAggregateZero, etc.
Use it to simplify X86WindowsTargetObjectFile::getSectionForConstant.
Modified:
llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp
Modified: llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp?rev=213104&r1=213103&r2=213104&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp Tue Jul 15 18:01:10 2014
@@ -151,15 +151,9 @@ X86WindowsTargetObjectFile::getSectionFo
uint64_t NumBits = VTy->getBitWidth();
if (NumBits == 128 || NumBits == 256) {
COMDATSymName = NumBits == 128 ? "__xmm@" : "__ymm@";
- if (const auto *CDV = dyn_cast<ConstantDataVector>(C)) {
- for (int I = CDV->getNumElements() - 1, E = -1; I != E; --I)
- COMDATSymName +=
- scalarConstantToHexString(CDV->getElementAsConstant(I));
- } else {
- const auto *CV = cast<ConstantVector>(C);
- for (int I = CV->getNumOperands() - 1, E = -1; I != E; --I)
- COMDATSymName += scalarConstantToHexString(CV->getOperand(I));
- }
+ for (int I = VTy->getNumElements() - 1, E = -1; I != E; --I)
+ COMDATSymName +=
+ scalarConstantToHexString(C->getAggregateElement(I));
}
}
if (!COMDATSymName.empty()) {
More information about the llvm-commits
mailing list