Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turning on predicate simplifier pass breaks llvm-gcc bootstrapping #1338

Closed
llvmbot opened this issue Oct 23, 2006 · 10 comments
Closed

Turning on predicate simplifier pass breaks llvm-gcc bootstrapping #1338

llvmbot opened this issue Oct 23, 2006 · 10 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla miscompilation

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Oct 23, 2006

Bugzilla Link 966
Resolution FIXED
Resolved on Mar 06, 2010 13:58
Version trunk
OS All
Reporter LLVM Bugzilla Contributor
CC @lattner

Extended Description

We recently added the predicate simplifier pass to llvm-gcc. See
gcc/llvm-backend.cpp

Sometime after 10/21, llvm-gcc bootstrapping broke. There were only a handful of
changes. After eliminating the possibility of Chris' changes may have broke it,
I tried disabling the predsimplfier pass. That did the trick.

Nick, please do a llvm-gcc build:

svn co ... llvm-gcc
cd llvm-gcc
cvs co llvm
mkdir -p build/obj build/dst build/sym
gnumake install RC_OS=macos RC_ARCHS='i386 ppc' TARGETS='i386 ppc' SRCROOT=pwd
OBJROOT=pwd/build/obj DSTROOT=pwd/build/dst SYMROOT=pwd/build/sym

The failure looks like this:

./xgcc -B./ -B/usr/local/llvm-gcc-install/i686-apple-darwin8/bin/ -isystem
/usr/local/llvm-gcc-install/i686-apple-darwin8/include -isystem
/usr/local/llvm-gcc-install/i686-apple-darwin8/sys-include -L/Volumes/
Wildlings/echeng/SUBMISSIONS/llvm-submission/build/obj/obj-i686-i686/gcc/../ld
-O2 -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes
-Wmissing-prototypes -Wold-style-definition -isystem ./include -fP
IC -pipe -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -I. -I.
-I/Volumes/Wildlings/echeng/SUBMISSIONS/llvm-submission/build/obj/src/gcc
-I/Volumes/Wildlings/echeng/SUBMISSIONS/llvm-submission/
build/obj/src/gcc/.
-I/Volumes/Wildlings/echeng/SUBMISSIONS/llvm-submission/build/obj/src/gcc/../include
-I./../intl
-I/Volumes/Wildlings/echeng/SUBMISSIONS/llvm-submission/build/obj/src/gcc/../libcpp/include

-I/Volumes/Wildlings/echeng/SUBMISSIONS/llvm-submission/build/obj/src/llvm/include
-I/Volumes/Wildlings/echeng/SUBMISSIONS/llvm-submission/build/obj/obj-llvm/include
-DL_muldi3 -c /Volumes/Wildlings/echeng/S
UBMISSIONS/llvm-submission/build/obj/src/gcc/libgcc2.c -o libgcc/./_muldi3.o
In file included from
/Volumes/Wildlings/echeng/SUBMISSIONS/llvm-submission/build/obj/src/gcc/tsystem.h:47,
from
/Volumes/Wildlings/echeng/SUBMISSIONS/llvm-submission/build/obj/src/gcc/libgcc2.c:41:
./include/stddef.h:152: error: storage class specified for parameter 'ptrdiff_t'
./include/stddef.h:214: error: storage class specified for parameter 'size_t'
./include/stddef.h:326: error: storage class specified for parameter 'wchar_t'
In file included from
/Volumes/Wildlings/echeng/SUBMISSIONS/llvm-submission/build/obj/src/gcc/tsystem.h:87,
from
/Volumes/Wildlings/echeng/SUBMISSIONS/llvm-submission/build/obj/src/gcc/libgcc2.c:41:
./include/stdarg.h:43: error: storage class specified for parameter '__gnuc_va_list'
./include/stdarg.h:105: error: syntax error before 'va_list'
...

@llvmbot
Copy link
Collaborator Author

llvmbot commented Oct 23, 2006

assigned to @nlewycky

@lattner
Copy link
Collaborator

lattner commented Oct 24, 2006

I have verified that reverting back to 1.24 does not fix the bug.  It does, however, change the failure mode.

@nlewycky
Copy link
Contributor

Hm. My problem is, I just did an llvm-gcc bootstrap build last night. It works
for me.

Of course, I'm running x86/linux, which is probably the major difference. What I
need here is a testcase. Do you have any other examples of code being
miscompiled by predsimplify? It would be much easier than trying to debug GCC.

Otherwise, someone's going to have to isolate the testcase out of gcc; compile
half the code with LLVM, half the code with GCC and link. See if the bug is
there, rinse & repeat. Getting it down to the .c file being miscompiled is good
enough for me.

Alternately, you could try narrowing down the optzns in predsimplify instead.
The major change from 1.23 and 1.24 was the workings of resolve. Try removing
the call to "resolve" from "addImpliedProperties". If the bug goes away, then
one of the transforms in resolve() is the culprit, otherwise it's either
addImpliedProperties or one of the Forwards::visit* methods.

If you can narrow it down for me, I can take it from there...

@nlewycky
Copy link
Contributor

To be specific, when following the instructions, I get:

$ make install RC_OS=macos RC_ARCHS='i386 ppc' TARGETS='i386 ppc' SRCROOT=pwd
OBJROOT=pwd/build/obj DSTROOT=pwd/build/dst SYMROOT=pwd/build/sym
GNUmakefile:16: /CoreOS/Standard/Standard.make: No such file or directory
make: *** No rule to make target `/CoreOS/Standard/Standard.make'. Stop.

@lattner
Copy link
Collaborator

lattner commented Oct 24, 2006

I reverted the predsimplifier back to 1.21.  Something in r1.22 broke it.  I don't follow the logic well
enough to understand what is going on.

-Chris

@nlewycky
Copy link
Contributor

Chris, could you start with r1.24 and #if 0 away the code in case
Instruction:Xor and replace it with just "break;" ? Does that remove the problem?

@nlewycky
Copy link
Contributor

Ok, I can reproduce this bug on x86/linux by running "make cleanstrap" (thanks
Chris for the clue). I'll try disabling parts of predsimplify until it works.

@nlewycky
Copy link
Contributor

I've found and fixed a couple of miscompile bugs, but this bug remains.

It goes away if I remove the "case Instruction::Or" from addImpliedProperties. I
can further say that it's not caused by the bool type. What I'm doing now is
printing out a message when this optimization occurs. I'm going to use that to
narrow down the list of .c files that I need to binary search on.

Regardless, this is going to take a few days.

@nlewycky
Copy link
Contributor

I have a predicate simplifier partial rewrite which fixes this problem. I'm
hoping to land the change this upcoming week.

Thanks for your patience...

@nlewycky
Copy link
Contributor

New code has been checked in. I can bootstrap with predsimplify enabled. If you
can't, please reopen this bug.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla miscompilation
Projects
None yet
Development

No branches or pull requests

3 participants