diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 9187c6c..1526fb1 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -1260,8 +1260,8 @@ void AsmPrinter::EmitLLVMUsedList(const ConstantArray *InitList) {
   // Should be an array of 'i8*'.
   for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i) {
     const GlobalValue *GV =
-      dyn_cast<GlobalValue>(InitList->getOperand(i)->stripPointerCasts());
-    if (GV && getObjFileLowering().shouldEmitUsedDirectiveFor(GV, Mang))
+      cast<GlobalValue>(InitList->getOperand(i)->stripPointerCastsOnly());
+    if (getObjFileLowering().shouldEmitUsedDirectiveFor(GV, Mang))
       OutStreamer.EmitSymbolAttribute(Mang->getSymbol(GV), MCSA_NoDeadStrip);
   }
 }
diff --git a/test/CodeGen/X86/compiler_used.ll b/test/CodeGen/X86/compiler_used.ll
index d38ce91..7129a53 100644
--- a/test/CodeGen/X86/compiler_used.ll
+++ b/test/CodeGen/X86/compiler_used.ll
@@ -4,9 +4,12 @@
 @Y = internal global i32 123
 @Z = internal global i8 4
 
-@llvm.used = appending global [1 x i8*] [ i8* @Z ], section "llvm.metadata"
+@XA = alias i8* @X
+
+@llvm.used = appending global [2 x i8*] [ i8* @Z, i8* @XA ], section "llvm.metadata"
 @llvm.compiler_used = appending global [2 x i8*] [ i8* @X, i8* bitcast (i32* @Y to i8*)], section "llvm.metadata"
 
 ; CHECK-NOT: .no_dead_strip
 ; CHECK: .no_dead_strip	_Z
+; CHECK: .no_dead_strip	_XA
 ; CHECK-NOT: .no_dead_strip
