Index: lib/Target/ARM/ARMISelLowering.cpp =================================================================== --- lib/Target/ARM/ARMISelLowering.cpp +++ lib/Target/ARM/ARMISelLowering.cpp @@ -3067,8 +3067,6 @@ SDLoc dl(Op); const GlobalValue *GV = cast(Op)->getGlobal(); const TargetMachine &TM = getTargetMachine(); - if (const GlobalAlias *GA = dyn_cast(GV)) - GV = GA->getBaseObject(); bool IsRO = (isa(GV) && cast(GV)->isConstant()) || isa(GV); Index: test/CodeGen/ARM/alias_store.ll =================================================================== --- /dev/null +++ test/CodeGen/ARM/alias_store.ll @@ -0,0 +1,18 @@ +; PR31896: address of @XA should lower to XA, not to X. +; RUN: llc < %s | FileCheck %s + +target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" +target triple = "thumbv7--linux" + +@X = constant {i8, i8 } { i8 0, i8 0 } +@XA = alias i8, getelementptr inbounds ({ i8, i8 }, {i8, i8}* @X, i32 0, i32 1) + +define void @f(i8** %p) align 2 { +entry: + store i8* @XA, i8 **%p, align 4 + ret void +} + +; CHECK: movw r1, :lower16:XA +; CHECK: movt r1, :upper16:XA +; CHECK: str r1, [r0]