[llvm-dev] IR changes from 3.6 to 3.7
Bas van den Berg via llvm-dev
llvm-dev at lists.llvm.org
Sat Nov 28 23:14:20 PST 2015
Hi,
I'm developing a compiler based on LLVM. It was first based on LLVM 3.2 and
I have rebased it on every release since. I also have unit tests that check
generated
IR code. I am testing my software on Linux (Ubuntu 14.04) and on Mac OS X.
Until now, the generated IR code was identical, but in 3.7 this has changed.
I'm wondering why this is..
Both versions have been build with the same version of LLVM/Clang, but
there are
differences in the way I had to build them. So the real question is,
whether the differences
in building (see below) cause this, or the different platform...
--- Linux Build ---
../llvm/configure --enable-optimized --prefix=$HOME/llvm-c2/
--with-python=/usr/bin/python2
--- OS X Build ---
cmake -G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE="RelWithDebInfo" \
-DCMAKE_ENABLE_ASSERTIONS=ON \
-DCMAKE_INSTALL_PREFIX=$HOME/llvm-c2 \
../llvm
I have also tried build type "Release" but then you get a warning that the
ASSERTIONS flag is unused.
The smallest example I could find it hello world. On Linux this generates:
(only relevant part shown)
--- Linux IR ---
; Function Attrs: nounwind uwtable
define i32 @main(i32 %argc, i8** %argv) #0 {
entry:
%retval = alloca i32, align 4
%argc.addr = alloca i32, align 4
%argv.addr = alloca i8**, align 8
store i32 0, i32* %retval
store i32 %argc, i32* %argc.addr, align 4
store i8** %argv, i8*** %argv.addr, align 8
%call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x
i8], [13 x i8]* @.str, i32 0, i32 0))
ret i32 0
}
define i32 @main(i32 %argc, i8** %argv) #0 {
entry:
entry:
%retval = alloca i32, align 4
%argc.addr = alloca i32, align 4
%argv.addr = alloca i8**, align 8
store i32 0, i32* %retval
store i32 %argc, i32* %argc.addr, align 4
store i8** %argv, i8*** %argv.addr, align 8
%call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x
i8], [13 x i8]* @.str, i32 0, i32 0))
ret i32 0
}
--- OS X IR ---
define i32 @main(i32 %argc, i8** %argv) {
<---- NOTE missing 'entry:' here
%argc.addr = alloca i32
%argv.addr = alloca i8**
store i32 %argc, i32* %argc.addr
store i8** %argv, i8*** %argv.addr
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8],
[14 x i8]* @0, i32 0, i32 0))
ret i32 0
}
Any hints are welcome...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151129/fcfcdb5d/attachment.html>
More information about the llvm-dev
mailing list