llvm-6502/lib/CodeGen/SelectionDAG
Duncan Sands 3eba667081 Revert commits 96556 and 96640, because commit 96556 breaks the
dragonegg self-host build.  I reverted 96640 in order to revert
96556 (96640 goes on top of 96556), but it also looks like with
both of them applied the breakage happens even earlier.  The
symptom of the 96556 miscompile is the following crash:

  llvm[3]: Compiling AlphaISelLowering.cpp for Release build
  cc1plus: /home/duncan/tmp/tmp/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:4982: void llvm::SelectionDAG::ReplaceAllUsesWith(llvm::SDNode*, llvm::SDNode*, llvm::SelectionDAG::DAGUpdateListener*): Assertion `(!From->hasAnyUseOfValue(i) || From->getValueType(i) == To->getValueType(i)) && "Cannot use this version of ReplaceAllUsesWith!"' failed.
  Stack dump:
  0.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@_ZN4llvm19AlphaTargetLowering14LowerOperationENS_7SDValueERNS_12SelectionDAGE'
  g++: Internal error: Aborted (program cc1plus)

This occurs when building LLVM using LLVM built by LLVM (via
dragonegg).  Probably LLVM has miscompiled itself, though it
may have miscompiled GCC and/or dragonegg itself: at this point
of the self-host build, all of GCC, LLVM and dragonegg were built
using LLVM.  Unfortunately this kind of thing is extremely hard
to debug, and while I did rummage around a bit I didn't find any
smoking guns, aka obviously miscompiled code.

Found by bisection.

r96556 | evancheng | 2010-02-18 03:13:50 +0100 (Thu, 18 Feb 2010) | 5 lines

Some dag combiner goodness:
Transform br (xor (x, y)) -> br (x != y)
Transform br (xor (xor (x,y), 1)) -> br (x == y)
Also normalize (and (X, 1) == / != 1 -> (and (X, 1)) != / == 0 to match to "test on x86" and "tst on arm"

r96640 | evancheng | 2010-02-19 01:34:39 +0100 (Fri, 19 Feb 2010) | 16 lines

Transform (xor (setcc), (setcc)) == / != 1 to
(xor (setcc), (setcc)) != / == 1.

e.g. On x86_64
  %0 = icmp eq i32 %x, 0
  %1 = icmp eq i32 %y, 0
  %2 = xor i1 %1, %0
  br i1 %2, label %bb, label %return
=>
	testl   %edi, %edi
	sete    %al
	testl   %esi, %esi
	sete    %cl
	cmpb    %al, %cl
	je      LBB1_2



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96672 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-19 11:30:41 +00:00
..
CallingConvLower.cpp Change errs() to dbgs(). 2010-01-05 01:24:50 +00:00
CMakeLists.txt Rename SelectionDAGLowering to SelectionDAGBuilder, and rename 2009-11-23 18:04:58 +00:00
DAGCombiner.cpp Revert commits 96556 and 96640, because commit 96556 breaks the 2010-02-19 11:30:41 +00:00
FastISel.cpp Fix comments to reflect renaming elsewhere. 2010-02-10 00:11:11 +00:00
FunctionLoweringInfo.cpp move target-independent opcodes out of TargetInstrInfo 2010-02-09 19:54:29 +00:00
FunctionLoweringInfo.h Move CopyCatchInfo into FunctionLoweringInfo.cpp too, for consistency. 2009-11-23 18:12:11 +00:00
InstrEmitter.cpp move target-independent opcodes out of TargetInstrInfo 2010-02-09 19:54:29 +00:00
InstrEmitter.h Fix a typo in a comment. 2009-11-16 20:35:59 +00:00
LegalizeDAG.cpp Add non-temporal flags and remove an assumption of default arguments. 2010-02-15 17:00:31 +00:00
LegalizeFloatTypes.cpp Add non-temporal flags and remove an assumption of default arguments. 2010-02-15 17:00:31 +00:00
LegalizeIntegerTypes.cpp Add non-temporal flags and remove an assumption of default arguments. 2010-02-15 17:00:31 +00:00
LegalizeTypes.cpp Add non-temporal flags and remove an assumption of default arguments. 2010-02-15 17:00:31 +00:00
LegalizeTypes.h It seems better to scalarize vectors of size 1 instead of widening them. 2010-01-24 00:24:43 +00:00
LegalizeTypesGeneric.cpp Add non-temporal flags and remove an assumption of default arguments. 2010-02-15 17:00:31 +00:00
LegalizeVectorOps.cpp Revert an earlier change to SIGN_EXTEND_INREG for vectors. The VTSDNode 2010-01-09 02:13:55 +00:00
LegalizeVectorTypes.cpp Add non-temporal flags and remove an assumption of default arguments. 2010-02-15 17:00:31 +00:00
Makefile make -fno-rtti the default unless a directory builds with REQUIRES_RTTI. 2010-01-24 20:43:08 +00:00
ScheduleDAGFast.cpp Trim unneeded includes. 2010-01-21 21:44:43 +00:00
ScheduleDAGList.cpp Change errs() to dbgs(). 2010-01-05 01:24:43 +00:00
ScheduleDAGRRList.cpp move target-independent opcodes out of TargetInstrInfo 2010-02-09 19:54:29 +00:00
ScheduleDAGSDNodes.cpp Enable pre-regalloc scheduling load clustering by default. 2010-01-22 23:49:45 +00:00
ScheduleDAGSDNodes.h Teach pre-regalloc scheduler to schedule loads from nearby addresses. It may improve cache locality. This is controlled by -cluster-loads for now. 2010-01-22 03:36:51 +00:00
SDNodeOrdering.h Allow 0 as an order number. Don't assign an order to formal arguments. 2009-12-22 21:35:02 +00:00
SelectionDAG.cpp Make the non-temporal bit "significant" in MemSDNodes so they aren't 2010-02-17 20:21:42 +00:00
SelectionDAGBuilder.cpp There are two ways of checking for a given type, for example isa<PointerType>(T) 2010-02-16 11:11:14 +00:00
SelectionDAGBuilder.h Assign the ordering of SDNodes in a much less intrusive fashion. After the 2010-01-28 21:51:40 +00:00
SelectionDAGISel.cpp sink special case "cannotyetselect" for intrinsics out of the 2010-02-17 06:28:22 +00:00
SelectionDAGPrinter.cpp Change errs() to dbgs(). 2010-01-05 01:24:45 +00:00
TargetLowering.cpp Revert commits 96556 and 96640, because commit 96556 breaks the 2010-02-19 11:30:41 +00:00