LLVM backend for 6502
Go to file
Chandler Carruth bfed08e41f [x86] Start fixing a really subtle and terrible form of miscompile in
these DAG combines.

The DAG auto-CSE thing is truly terrible. Due to it, when RAUW-ing
a node with its operand, you can cause its uses to CSE to itself, which
then causes their uses to become your uses which causes them to be
picked up by the RAUW. For nodes that are determined to be "no-ops",
this is "fine". But if the RAUW is one of several steps to enact
a transformation, this causes the DAG to really silently eat an discard
nodes that you would never expect. It took days for me to actually
pinpoint a test case triggering this and a really frustrating amount of
time to even comprehend the bug because I never even thought about the
ability of RAUW to iteratively consume nodes due to CSE-ing them into
itself.

To fix this, we have to build up a brand-new chain of operations any
time we are combining across (potentially) intervening nodes. But once
the logic is added to do this, another issue surfaces: CombineTo eagerly
deletes the one node combined, *but no others*. This is... really
frustrating. If deleting it makes its operands become dead, those
operand nodes often won't go onto the worklist in the
order you would want -- they're already on it and not near the top. That
means things higher on the worklist will get combined prior to these
dead nodes being GCed out of the worklist, and if the chain is long, the
immediate users won't be enough to re-detect where the root of the chain
is that became single-use again after deleting the dead nodes. The
better way to do this is to never immediately delete nodes, and instead
to just enqueue them so we can recursively delete them. The
combined-from node is typically not on the worklist anyways by virtue of
having been popped off.... But that in turn breaks other tests that
*require* CombineTo to delete unused nodes. :: sigh ::

Fortunately, there is a better way. This whole routine should have been
returning the replacement rather than using CombineTo which is quite
hacky. Switch to that, and all the pieces fall together.

I suspect the same kind of miscompile is possible in the half-shuffle
folding code, and potentially the recursive folding code. I'll be
switching those over to a pattern more like this one for safety's sake
even though I don't immediately have any test cases for them. Note that
the only way I got a test case for this instance was with *heavily* DAG
combined 256-bit shuffle sequences generated by my fuzzer. ;]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216319 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-23 10:25:15 +00:00
autoconf Delete support for AuroraUX. 2014-08-14 15:15:09 +00:00
bindings [OCaml] Expose Llvm.get_operand_use. 2014-08-12 02:55:45 +00:00
cmake Disabling an MSVC warning ('var' : definition from the for loop is ignored; the definition from the enclosing scope is used) which will trigger false positives more than true positives. 2014-08-18 14:54:22 +00:00
docs ProgrammersManual: the flag is called -debug-only 2014-08-23 04:34:58 +00:00
examples Make it explicit that ExecutionEngine takes ownership of the modules. 2014-08-19 04:04:25 +00:00
include ARM / x86_64 varargs: Don't save regparms in prologue without va_start 2014-08-22 21:59:26 +00:00
lib [x86] Start fixing a really subtle and terrible form of miscompile in 2014-08-23 10:25:15 +00:00
projects [cmake] Use the external project machinery for libcxxabi so that it can 2014-07-25 10:27:40 +00:00
test [x86] Start fixing a really subtle and terrible form of miscompile in 2014-08-23 10:25:15 +00:00
tools Add support for comdats to the gold plugin. 2014-08-22 23:26:10 +00:00
unittests Fix PR17239 by changing the semantics of the RemainingArgsClass Option kind 2014-08-22 19:29:17 +00:00
utils Explicitly pass ownership of the MemoryBuffer to AddNewSourceBuffer using std::unique_ptr 2014-08-21 20:44:56 +00:00
.arcconfig Updated phabricator server. 2014-04-07 03:57:04 +00:00
.clang-format Test commit. 2014-03-02 13:08:46 +00:00
.gitignore Add Polly to the ignored trees. 2014-06-25 13:13:36 +00:00
CMakeLists.txt Fix building with in-tree libc++abi on FreeBSD 2014-08-01 19:23:15 +00:00
CODE_OWNERS.TXT Add a sentence that all entries should include an email address. 2014-08-04 19:33:25 +00:00
configure Delete support for AuroraUX. 2014-08-14 15:15:09 +00:00
CREDITS.TXT add self to credits 2014-08-21 04:27:11 +00:00
LICENSE.TXT Remove projects/sample. 2014-03-12 22:40:22 +00:00
llvm.spec.in
LLVMBuild.txt Remove the very substantial, largely unmaintained legacy PGO 2013-10-02 15:42:23 +00:00
Makefile [configure/make] Propagate names of build host tools when making BuildTools 2014-03-25 21:45:41 +00:00
Makefile.common Makefile.common: Update a description, s/Source/SOURCES/ , according to MakefileGuide.html#control-variables . 2012-12-07 01:43:23 +00:00
Makefile.config.in Track clang r213171 2014-07-16 16:50:34 +00:00
Makefile.rules Delete support for AuroraUX. 2014-08-14 15:15:09 +00:00
README.txt Trivial test commit. 2014-04-26 19:05:45 +00:00

Low Level Virtual Machine (LLVM)
================================

This directory and its subdirectories contain source code for the Low Level
Virtual Machine, a toolkit for the construction of highly optimized compilers,
optimizers, and runtime environments.

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.

Please see the documentation provided in docs/ for further
assistance with LLVM, and in particular docs/GettingStarted.rst for getting
started with LLVM and docs/README.txt for an overview of LLVM's
documentation setup.

If you're writing a package for LLVM, see docs/Packaging.rst for our
suggestions.