llvm-6502/lib/Transforms
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
..
Hello Finegrainify namespacification 2004-01-09 06:12:26 +00:00
Instrumentation Expand head-of-file comment. 2004-06-03 05:03:02 +00:00
IPO Fix a bug in the -deadtypeelim pass. The SymbolTable re-write changed it 2004-05-27 21:16:46 +00:00
Scalar Fix a bug in my checkin from last night that caused miscompilations of 2004-06-10 02:33:20 +00:00
Utils Fix one of the major things that is causing the C Backend to infinite loop 2004-05-28 05:02:13 +00:00
ExprTypeConvert.cpp Support getelementptr instructions which use uint's to index into structure 2004-04-05 01:30:19 +00:00
LevelRaise.cpp Support getelementptr instructions which use uint's to index into structure 2004-04-05 01:30:19 +00:00
Makefile
TransformInternals.cpp Support getelementptr instructions which use uint's to index into structure 2004-04-05 01:30:19 +00:00
TransformInternals.h