summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86SpeculativeLoadHardening.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2018-07-23 07:56:15 +0000
committerChandler Carruth <chandlerc@gmail.com>2018-07-23 07:56:15 +0000
commit1d926fb9f4a967c7d1ef7312e147933987c8cd7b (patch)
tree01a0beab6553a673e5087264b5310b40d0ba73be /llvm/lib/Target/X86/X86SpeculativeLoadHardening.cpp
parentb66f2d8df8c05328c4c478876b5ebb58564d7722 (diff)
downloadbcm5719-llvm-1d926fb9f4a967c7d1ef7312e147933987c8cd7b.tar.gz
bcm5719-llvm-1d926fb9f4a967c7d1ef7312e147933987c8cd7b.zip
[x86/SLH] Fix a bug where we would harden tail calls twice -- once as
a call, and then again as a return. Also added a comment to try and explain better why we would be doing what we're doing when hardening the (non-call) returns. llvm-svn: 337673
Diffstat (limited to 'llvm/lib/Target/X86/X86SpeculativeLoadHardening.cpp')
-rw-r--r--llvm/lib/Target/X86/X86SpeculativeLoadHardening.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/X86SpeculativeLoadHardening.cpp b/llvm/lib/Target/X86/X86SpeculativeLoadHardening.cpp
index c068507095a..3d2bbd3e55c 100644
--- a/llvm/lib/Target/X86/X86SpeculativeLoadHardening.cpp
+++ b/llvm/lib/Target/X86/X86SpeculativeLoadHardening.cpp
@@ -525,7 +525,11 @@ bool X86SpeculativeLoadHardeningPass::runOnMachineFunction(
continue;
MachineInstr &MI = MBB.back();
- if (!MI.isReturn())
+
+ // We only care about returns that are not also calls. For calls, that
+ // happen to also be returns (tail calls) we will have already handled
+ // them as calls.
+ if (!MI.isReturn() || MI.isCall())
continue;
hardenReturnInstr(MI);
OpenPOWER on IntegriCloud