A couple more vector component access fixes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62443 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index 6540b2c..4dd06b9 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -1160,6 +1160,17 @@
 bool ExtVectorElementExpr::containsDuplicateElements() const {
   const char *compStr = Accessor.getName();
   unsigned length = Accessor.getLength();
+
+  // Halving swizzles do not contain duplicate elements.
+  if (!strcmp(compStr, "hi") || !strcmp(compStr, "lo") || 
+      !strcmp(compStr, "even") || !strcmp(compStr, "odd"))
+    return false;
+  
+  // Advance past s-char prefix on hex swizzles.
+  if (*compStr == 's') {
+    compStr++;
+    length--;
+  }
   
   for (unsigned i = 0; i != length-1; i++) {
     const char *s = compStr+i;
diff --git a/test/CodeGen/ext-vector.c b/test/CodeGen/ext-vector.c
index 657b285..ae877ed 100644
--- a/test/CodeGen/ext-vector.c
+++ b/test/CodeGen/ext-vector.c
@@ -15,7 +15,7 @@
 float f;
 
 void test2() {
-    vec2 = vec4.rg;  // shorten
+    vec2 = vec4.xy;  // shorten
     f = vec2.x;      // extract elt
     vec4 = vec4.yyyy;  // splat
     
diff --git a/test/Coverage/c-language-features.inc b/test/Coverage/c-language-features.inc
index 6944b9d..9a52e56 100644
--- a/test/Coverage/c-language-features.inc
+++ b/test/Coverage/c-language-features.inc
@@ -136,7 +136,7 @@
 void f5() {
   float4 t0 = (float4) { 0, 1, 2, 3 };
   float4 t1 = t0;
-  t0.lo.e = t1.hi.x;
+  t0.lo.even = t1.hi.x;
 }
 
 void f6() {