forked from OSchip/llvm-project
Switch ExtVectorElementExpr::getEncodedElementAccess to use StringRef.
- Really this should be simplified by the FIXME above, but I'm too deep in DFS. llvm-svn: 84392
This commit is contained in:
parent
afff4340d5
commit
ce5a0b3deb
|
@ -1766,14 +1766,14 @@ bool ExtVectorElementExpr::containsDuplicateElements() const {
|
||||||
/// getEncodedElementAccess - We encode the fields as a llvm ConstantArray.
|
/// getEncodedElementAccess - We encode the fields as a llvm ConstantArray.
|
||||||
void ExtVectorElementExpr::getEncodedElementAccess(
|
void ExtVectorElementExpr::getEncodedElementAccess(
|
||||||
llvm::SmallVectorImpl<unsigned> &Elts) const {
|
llvm::SmallVectorImpl<unsigned> &Elts) const {
|
||||||
const char *compStr = Accessor->getName();
|
llvm::StringRef Comp = Accessor->getName();
|
||||||
if (*compStr == 's' || *compStr == 'S')
|
if (Comp[0] == 's' || Comp[0] == 'S')
|
||||||
compStr++;
|
Comp = Comp.substr(1);
|
||||||
|
|
||||||
bool isHi = !strcmp(compStr, "hi");
|
bool isHi = Comp == "hi";
|
||||||
bool isLo = !strcmp(compStr, "lo");
|
bool isLo = Comp == "lo";
|
||||||
bool isEven = !strcmp(compStr, "even");
|
bool isEven = Comp == "even";
|
||||||
bool isOdd = !strcmp(compStr, "odd");
|
bool isOdd = Comp == "odd";
|
||||||
|
|
||||||
for (unsigned i = 0, e = getNumElements(); i != e; ++i) {
|
for (unsigned i = 0, e = getNumElements(); i != e; ++i) {
|
||||||
uint64_t Index;
|
uint64_t Index;
|
||||||
|
@ -1787,7 +1787,7 @@ void ExtVectorElementExpr::getEncodedElementAccess(
|
||||||
else if (isOdd)
|
else if (isOdd)
|
||||||
Index = 2 * i + 1;
|
Index = 2 * i + 1;
|
||||||
else
|
else
|
||||||
Index = ExtVectorType::getAccessorIdx(compStr[i]);
|
Index = ExtVectorType::getAccessorIdx(Comp[i]);
|
||||||
|
|
||||||
Elts.push_back(Index);
|
Elts.push_back(Index);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue