2015-10-05 11:49 GMT+02:00 Rinaldini Julien via llvm-dev
<llvm...@lists.llvm.org>:
> Sorry, the error is (the previous one was from Apple’s lli):
>
> Documents/strong.codes/code/build/obfuscator-llvm/bin/opt: test.ll:57:203: error: expected comma after getelementptr's type
> @_METACLASS_DATA__TtC4test13TipCalculator = private constant { i32, i32, i32, i32, i8*, i8*, i8*, i8*, i8*, i8*, i8* } { i32 129, i32 40, i32 40, i32 0, i8* null, i8* getelementptr inbounds ([25 x i8]* @7, i64 0, i64 0), i8* null, i8* null, i8* null, i8* null, i8* null }, section "__DATA, __objc_const", align 8
The IR format is not stable and it seems like Swift is using an LLVM <
3.7, while your opt executable is from LLVM 3.7. The `getelementptr`
instruction (besides others) now expects the pointer type to be given
explicitly. I don't know Swift, but if you can get it to emit bitcode
instead of IR, that should work AFAIK. Looking at the command line,
you probably need -emit-bc.
Björn
Be careful if this is intended for production use, there's nothing
forbidding Swift from making use of LLVM extensions (IR or backend)
that don't exist in OSS (yet). The only compiler that can definitely
consume IR produced by swiftc is swiftc.
Cheers.
Tim.