llvm/lib
Dan Gohman b5e0bec282 Add an @llvm.sideeffect intrinsic
This patch implements Chandler's idea [0] for supporting languages that
require support for infinite loops with side effects, such as Rust, providing
part of a solution to bug 965 [1].

Specifically, it adds an `llvm.sideeffect()` intrinsic, which has no actual
effect, but which appears to optimization passes to have obscure side effects,
such that they don't optimize away loops containing it. It also teaches
several optimization passes to ignore this intrinsic, so that it doesn't
significantly impact optimization in most cases.

As discussed on llvm-dev [2], this patch is the first of two major parts.
The second part, to change LLVM's semantics to have defined behavior
on infinite loops by default, with a function attribute for opting into
potential-undefined-behavior, will be implemented and posted for review in
a separate patch.

[0] http://lists.llvm.org/pipermail/llvm-dev/2015-July/088103.html
[1] https://bugs.llvm.org/show_bug.cgi?id=965
[2] http://lists.llvm.org/pipermail/llvm-dev/2017-October/118632.html

Differential Revision: https://reviews.llvm.org/D38336


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317729 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-08 21:59:51 +00:00
..
Analysis Add an @llvm.sideeffect intrinsic 2017-11-08 21:59:51 +00:00
AsmParser [IR] redefine 'UnsafeAlgebra' / 'reassoc' fast-math-flags and add 'trans' fast-math-flag 2017-11-06 16:27:15 +00:00
BinaryFormat Simplify. 2017-10-19 01:32:18 +00:00
Bitcode [IR] redefine 'UnsafeAlgebra' / 'reassoc' fast-math-flags and add 'trans' fast-math-flag 2017-11-06 16:27:15 +00:00
CodeGen Add an @llvm.sideeffect intrinsic 2017-11-08 21:59:51 +00:00
DebugInfo Convert FileOutputBuffer to Expected. NFC. 2017-11-08 01:05:44 +00:00
Demangle
ExecutionEngine ExecutionEngine: make COFF Thumb2 assertions non-tautological 2017-10-22 20:51:25 +00:00
Fuzzer [libFuzzer] Delete llvm/lib/Fuzzer 2017-10-16 20:48:19 +00:00
FuzzMutate FuzzMutate: Fix arch parsing in FuzzerCLI 2017-10-17 02:39:40 +00:00
IR Make DIExpression::createFragmentExpression() return an Optional. 2017-11-07 00:45:34 +00:00
IRReader Move the stripping of invalid debug info from the Verifier to AutoUpgrade. 2017-10-02 18:31:29 +00:00
LineEditor
Linker
LTO [LTO][ThinLTO] Use the linker resolutions to mark global values as dso_local. 2017-11-04 17:04:39 +00:00
MC NFC: Rename MCSafeSEHFragment to MCSymbolIdFragment 2017-11-08 18:57:02 +00:00
Object Revert r317046, "Object: Move some code from ELF.h into ELF.cpp." 2017-11-03 21:30:06 +00:00
ObjectYAML Revert "Reapply: Allow yaml2obj to order implicit sections for ELF" 2017-11-08 01:31:20 +00:00
Option Reverting r315590; it did not include changes for llvm-tblgen, which is causing link errors for several people. 2017-10-15 14:32:27 +00:00
Passes [PassManager, SimplifyCFG] Revert r316908 and r316869. 2017-11-06 00:32:01 +00:00
ProfileData GCOV: Move GCOV from IR & Support into ProfileData to fix layering 2017-11-03 20:57:10 +00:00
Support Convert FileOutputBuffer::commit to Error. 2017-11-08 01:50:29 +00:00
TableGen [globalisel][regbank] Warn about MIR ambiguities when register bank/class names clash. 2017-11-01 22:13:05 +00:00
Target Revert "Correct dwarf unwind information in function epilogue for X86" 2017-11-08 21:31:14 +00:00
Testing Force #define GTEST_LANG_CXX11. 2017-10-27 21:12:28 +00:00
ToolDrivers [COFF] Improve the check for functions that should get an extra underscore 2017-10-23 09:08:13 +00:00
Transforms Add an @llvm.sideeffect intrinsic 2017-11-08 21:59:51 +00:00
WindowsManifest
XRay [XRay][tools] Support arg1 logging entries in the basic logging mode 2017-10-05 05:18:17 +00:00
CMakeLists.txt
LLVMBuild.txt