mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-09-10 06:54:54 +00:00
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
51 lines
2.2 KiB
LLVM
51 lines
2.2 KiB
LLVM
; RUN: llc < %s -mtriple=i386-apple-darwin -tailcallopt=false -stats -info-output-file - | grep asm-printer | grep 31
|
|
|
|
%CC = type { %Register }
|
|
%II = type { %"struct.XX::II::$_74" }
|
|
%JITFunction = type %YYValue* (%CC*, %YYValue**)
|
|
%YYValue = type { i32 (...)** }
|
|
%Register = type { %"struct.XX::ByteCodeFeatures" }
|
|
%"struct.XX::ByteCodeFeatures" = type { i32 }
|
|
%"struct.XX::II::$_74" = type { i8* }
|
|
@llvm.used = appending global [1 x i8*] [ i8* bitcast (%JITFunction* @loop to i8*) ], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0]
|
|
|
|
define %YYValue* @loop(%CC*, %YYValue**) nounwind {
|
|
; <label>:2
|
|
%3 = getelementptr %CC* %0, i32 -9 ; <%CC*> [#uses=1]
|
|
%4 = bitcast %CC* %3 to %YYValue** ; <%YYValue**> [#uses=2]
|
|
%5 = load %YYValue** %4 ; <%YYValue*> [#uses=3]
|
|
%unique_1.i = ptrtoint %YYValue* %5 to i1 ; <i1> [#uses=1]
|
|
br i1 %unique_1.i, label %loop, label %11
|
|
|
|
loop: ; preds = %6, %2
|
|
%.1 = phi %YYValue* [ inttoptr (i32 1 to %YYValue*), %2 ], [ %intAddValue, %6 ] ; <%YYValue*> [#uses=3]
|
|
%immediateCmp = icmp slt %YYValue* %.1, %5 ; <i1> [#uses=1]
|
|
br i1 %immediateCmp, label %6, label %8
|
|
|
|
; <label>:6 ; preds = %loop
|
|
%lhsInt = ptrtoint %YYValue* %.1 to i32 ; <i32> [#uses=1]
|
|
%7 = call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 %lhsInt, i32 2) ; <{ i32, i1 }> [#uses=2]
|
|
%intAdd = extractvalue { i32, i1 } %7, 0 ; <i32> [#uses=1]
|
|
%intAddValue = inttoptr i32 %intAdd to %YYValue* ; <%YYValue*> [#uses=1]
|
|
%intAddOverflow = extractvalue { i32, i1 } %7, 1 ; <i1> [#uses=1]
|
|
br i1 %intAddOverflow, label %.loopexit, label %loop
|
|
|
|
; <label>:8 ; preds = %loop
|
|
ret %YYValue* inttoptr (i32 10 to %YYValue*)
|
|
|
|
.loopexit: ; preds = %6
|
|
%9 = bitcast %CC* %0 to %YYValue** ; <%YYValue**> [#uses=1]
|
|
store %YYValue* %.1, %YYValue** %9
|
|
store %YYValue* %5, %YYValue** %4
|
|
%10 = call fastcc %YYValue* @foobar(%II* inttoptr (i32 3431104 to %II*), %CC* %0, %YYValue** %1) ; <%YYValue*> [#uses=1]
|
|
ret %YYValue* %10
|
|
|
|
; <label>:11 ; preds = %2
|
|
%12 = call fastcc %YYValue* @foobar(%II* inttoptr (i32 3431080 to %II*), %CC* %0, %YYValue** %1) ; <%YYValue*> [#uses=1]
|
|
ret %YYValue* %12
|
|
}
|
|
|
|
declare fastcc %YYValue* @foobar(%II*, %CC*, %YYValue**) nounwind
|
|
|
|
declare { i32, i1 } @llvm.sadd.with.overflow.i32(i32, i32) nounwind
|