[PATCH] D76639: Change X86RetpolineThunks from a MachineFunctionPass to a ModulePass

Scott Constable via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 23 13:06:40 PDT 2020


sconstab created this revision.
sconstab added reviewers: chandlerc, zbrid, craig.topper, andrew.w.kaylor.
Herald added subscribers: jfb, hiraditya.

X86RetpolineThunks had been implemented as a MachineFunctionPass. Its behavior is to examine each function in a module, and determine whether that function requires the X86 retpoline feature. If so, retpoline thunk(s) are inserted into the module, if they have not been inserted already. This behavior seems to make more sense as a ModulePass.

In this patch, `runOnModule()` iterates through all of the functions in the module. As soon as a function requiring retpolines is encountered, the retpoline thunk is inserted and populated. This is probably more efficient than the prior implementation, and it also does not require the pass to carry around any internal state.

One consequence of making this a ModulePass is that it seems to affect the ordering of suffix generation for temporary symbols. Therefore some regression tests needed to be lightly edited.


https://reviews.llvm.org/D76639

Files:
  llvm/lib/Target/X86/X86.h
  llvm/lib/Target/X86/X86RetpolineThunks.cpp
  llvm/test/CodeGen/X86/O0-pipeline.ll
  llvm/test/CodeGen/X86/O3-pipeline.ll
  llvm/test/CodeGen/X86/speculative-load-hardening-indirect.ll
  llvm/test/CodeGen/X86/statepoint-invoke.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76639.252126.patch
Type: text/x-patch
Size: 25910 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200323/3e27459e/attachment.bin>


More information about the llvm-commits mailing list