From 48d72342ffd5fdbc1b247a97472a4446362e1771 Mon Sep 17 00:00:00 2001 From: Marcin Koscielnicki Date: Thu, 21 Apr 2016 17:36:05 +0000 Subject: [PATCH] [PowerPC] [SSP] Fix stack guard load for 32-bit. r266809 incorrectly used LD to load the stack guard, it should be LWZ. Differential Revision: http://reviews.llvm.org/D19358 llvm-svn: 267017 --- llvm/lib/Target/PowerPC/PPCInstrInfo.cpp | 2 +- llvm/test/CodeGen/PowerPC/stack-protector.ll | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp b/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp index 9b682dae..204dc28 100644 --- a/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp +++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp @@ -1864,7 +1864,7 @@ bool PPCInstrInfo::expandPostRAPseudo(MachineBasicBlock::iterator MI) const { "Only Linux target is expected to contain LOAD_STACK_GUARD"); const int64_t Offset = Subtarget.isPPC64() ? -0x7010 : -0x7008; const unsigned Reg = Subtarget.isPPC64() ? PPC::X13 : PPC::R2; - MI->setDesc(get(PPC::LD)); + MI->setDesc(get(Subtarget.isPPC64() ? PPC::LD : PPC::LWZ)); MachineInstrBuilder(*MI->getParent()->getParent(), MI) .addImm(Offset) .addReg(Reg); diff --git a/llvm/test/CodeGen/PowerPC/stack-protector.ll b/llvm/test/CodeGen/PowerPC/stack-protector.ll index 8760f19..57d1c7e 100644 --- a/llvm/test/CodeGen/PowerPC/stack-protector.ll +++ b/llvm/test/CodeGen/PowerPC/stack-protector.ll @@ -5,7 +5,7 @@ ; DARWIN32: __stack_chk_guard ; DARWIN64: __stack_chk_guard -; LINUX32: ld {{[0-9]+}}, -28680(2) +; LINUX32: lwz {{[0-9]+}}, -28680(2) ; LINUX64: ld {{[0-9]+}}, -28688(13) ; DARWIN32: __stack_chk_fail -- 2.7.4