LLVM backend for 6502
Go to file
Chris Lattner 3285a6f426 Fix a bug in my checkin from last night that caused miscompilations of
186.crafty, fhourstones and 132.ijpeg.

Bugpoint makes really nasty miscompilations embarassingly easy to find.  It
narrowed it down to the instcombiner and this testcase (from fhourstones):

bool %l7153_l4706_htstat_loopentry_2E_4_no_exit_2E_4(int* %i, [32 x int]* %works, int* %tmp.98.out) {
newFuncRoot:
        %tmp.96 = load int* %i          ; <int> [#uses=1]
        %tmp.97 = getelementptr [32 x int]* %works, long 0, int %tmp.96         ; <int*> [#uses=1]
        %tmp.98 = load int* %tmp.97             ; <int> [#uses=2]
        %tmp.99 = load int* %i          ; <int> [#uses=1]
        %tmp.100 = and int %tmp.99, 7           ; <int> [#uses=1]
        %tmp.101 = seteq int %tmp.100, 7                ; <bool> [#uses=2]
        %tmp.102 = cast bool %tmp.101 to int            ; <int> [#uses=0]
        br bool %tmp.101, label %codeRepl4.exitStub, label %codeRepl3.exitStub

codeRepl4.exitStub:             ; preds = %newFuncRoot
        store int %tmp.98, int* %tmp.98.out
        ret bool true

codeRepl3.exitStub:             ; preds = %newFuncRoot
        store int %tmp.98, int* %tmp.98.out
        ret bool false
}

... which only has one combination performed on it:

$ llvm-as < t.ll | opt -instcombine -debug | llvm-dis
IC: Old =       %tmp.101 = seteq int %tmp.100, 7                ; <bool> [#uses=1]
    New =       setne int %tmp.100, 0           ; <bool>:<badref> [#uses=0]
IC: MOD =       br bool %tmp.101, label %codeRepl3.exitStub, label %codeRepl4.exitStub
IC: MOD =       %tmp.97 = getelementptr [32 x int]* %works, uint 0, int %tmp.96         ; <int*> [#uses=1]

It doesn't get much better than this.  :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14109 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-10 02:33:20 +00:00
autoconf Added checks for mkstemp and getrusage. 2004-06-07 14:26:24 +00:00
docs Minor tweaks 2004-06-09 03:59:05 +00:00
examples/ModuleMaker Configure script for ModuleMaker. 2003-11-25 20:02:07 +00:00
include Add new BinaryOperator::createAdd/Sub/... methods to avoid having to type 2004-06-10 01:43:29 +00:00
lib Fix a bug in my checkin from last night that caused miscompilations of 2004-06-10 02:33:20 +00:00
projects Add support for dos-style files 2004-05-27 18:28:32 +00:00
runtime Continue the implementation 2004-05-27 05:51:31 +00:00
test More instcombine testcases 2004-06-09 07:59:40 +00:00
tools Clean up the documentation. 2004-06-08 05:56:58 +00:00
utils Columnized the compilation statistics for easier reading. 2004-06-09 18:29:15 +00:00
.cvsignore Ok, try #2, this time I'll not be stupid 2003-08-03 18:33:24 +00:00
configure Added checks for mkstemp and getrusage. 2004-06-07 14:26:24 +00:00
CREDITS.TXT Just testing the "Reid has CVS commit access" system 2004-05-06 18:06:18 +00:00
LICENSE.TXT Add spiff 2004-06-01 20:37:41 +00:00
llvm.spec RPM spec file for LLVM tools and libraries. 2004-02-10 03:57:51 +00:00
llvm.spec.in RPM spec file for LLVM tools and libraries. 2004-02-10 03:57:51 +00:00
Makefile Change the install-includes target to completely ignore the llvm/Internal 2004-05-25 20:01:25 +00:00
Makefile.common Standardize header comments of top-level Makefiles. 2004-04-24 00:10:56 +00:00
Makefile.config.in Added the EXEEXT variable so that Makefiles can figure out what extension 2004-06-01 19:04:38 +00:00
Makefile.rules Explicitly specify libtool tag "CXX" so that if you setenv CXX to something 2004-06-08 18:52:45 +00:00
README.txt This file has been superseded by docs/index.html . 2004-05-12 02:48:30 +00:00

This file is a placeholder; see docs/index.html for documentation.