[PATCH] D19358: [PowerPC] [SSP] Fix stack guard load for 32-bit.

Marcin Koƛcielnicki via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 21 04:12:47 PDT 2016


koriakin created this revision.
koriakin added reviewers: hfinkel, timshen, echristo.
koriakin added a subscriber: llvm-commits.
koriakin set the repository for this revision to rL LLVM.
Herald added a subscriber: joker.eph.

r266809 incorrectly used LD to load the stack guard, it should be LWZ.

Repository:
  rL LLVM

http://reviews.llvm.org/D19358

Files:
  lib/Target/PowerPC/PPCInstrInfo.cpp
  test/CodeGen/PowerPC/stack-protector.ll

Index: test/CodeGen/PowerPC/stack-protector.ll
===================================================================
--- test/CodeGen/PowerPC/stack-protector.ll
+++ 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
Index: lib/Target/PowerPC/PPCInstrInfo.cpp
===================================================================
--- lib/Target/PowerPC/PPCInstrInfo.cpp
+++ lib/Target/PowerPC/PPCInstrInfo.cpp
@@ -1864,7 +1864,7 @@
            "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);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19358.54483.patch
Type: text/x-patch
Size: 1057 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160421/b9631001/attachment.bin>


More information about the llvm-commits mailing list