llvm-6502/lib
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
..
Analysis Don't grab the condition of unconditional branches! 2004-06-08 21:50:30 +00:00
Archive Use the new FileUtilities.h API for mapping a file into an address 2004-05-28 00:24:41 +00:00
AsmParser Remove some more dead code resulting from adding setTypeName(). 2004-05-28 00:21:06 +00:00
Bytecode Cleanup alignment of output. 2004-06-09 06:22:00 +00:00
CodeGen Remove an unused variable. 2004-06-05 01:05:19 +00:00
Debugger "fix" a nasty race condition 2004-01-14 21:18:03 +00:00
ExecutionEngine Implement PR315: abort, don't warn, when missing external functions encountered 2004-06-01 21:49:00 +00:00
Linker Move some functions out of gccld.cpp to GenerateCode.cpp. This allows us 2004-06-02 00:22:24 +00:00
Support Make all of this functionality work directly on win32. Properly conditionalize 2004-06-07 19:37:24 +00:00
Target Encode %fsr correctly; don't fail an assertion. 2004-06-09 21:54:59 +00:00
Transforms Fix a bug in my checkin from last night that caused miscompilations of 2004-06-10 02:33:20 +00:00
VMCore Share some code 2004-06-10 01:57:38 +00:00
Makefile CBackend is no longer here 2004-02-13 23:29:37 +00:00