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:
Daniel Dunbar 2009-10-18 02:09:31 +00:00
parent afff4340d5
commit ce5a0b3deb
1 changed files with 8 additions and 8 deletions

View File

@ -1766,14 +1766,14 @@ bool ExtVectorElementExpr::containsDuplicateElements() const {
/// getEncodedElementAccess - We encode the fields as a llvm ConstantArray.
void ExtVectorElementExpr::getEncodedElementAccess(
llvm::SmallVectorImpl<unsigned> &Elts) const {
const char *compStr = Accessor->getName();
if (*compStr == 's' || *compStr == 'S')
compStr++;
llvm::StringRef Comp = Accessor->getName();
if (Comp[0] == 's' || Comp[0] == 'S')
Comp = Comp.substr(1);
bool isHi = !strcmp(compStr, "hi");
bool isLo = !strcmp(compStr, "lo");
bool isEven = !strcmp(compStr, "even");
bool isOdd = !strcmp(compStr, "odd");
bool isHi = Comp == "hi";
bool isLo = Comp == "lo";
bool isEven = Comp == "even";
bool isOdd = Comp == "odd";
for (unsigned i = 0, e = getNumElements(); i != e; ++i) {
uint64_t Index;
@ -1787,7 +1787,7 @@ void ExtVectorElementExpr::getEncodedElementAccess(
else if (isOdd)
Index = 2 * i + 1;
else
Index = ExtVectorType::getAccessorIdx(compStr[i]);
Index = ExtVectorType::getAccessorIdx(Comp[i]);
Elts.push_back(Index);
}