kaleidoscope icon indicating copy to clipboard operation
kaleidoscope copied to clipboard

Initial work on refactor to LLVM 9.0

Open sdiehl opened this issue 4 years ago • 3 comments

sdiehl avatar Dec 30 '19 13:12 sdiehl

Just tried this on LLVM 9.0 and "stack build" fails with many errors. Any estimate on when support for LLVM 9.0 will be coming?

xhliu avatar Apr 21 '20 06:04 xhliu

Chapter 6 will work. As for when it will be done, that's just a function of when I find the time. You can reference the llvm-hs-examples and the Kaleidoscope repo there for more up to date code.

sdiehl avatar Apr 21 '20 07:04 sdiehl

@sdiehl I tried to build llvm-hs-examples on Mac Catalina, it gave the following errors:

 [114 of 114] Compiling LLVM.PassManager ( src/LLVM/PassManager.hs, .stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/LLVM/PassManager.o )
    
    /private/var/folders/zg/mkwy5rhs06dbyf6rmxgrrb8w0000gn/T/stack6665/llvm-hs-9.0.0/src/LLVM/Internal/FFI/PassManagerC.cpp:159:69: error:
         error: non-constant-expression cannot be narrowed from type 'LLVMBool' (aka 'int') to 'bool' in initializer list [-Wc++11-narrowing]
                unwrap(PM)->add(createMemorySanitizerLegacyPassPass({trackOrigins, recover, kernel}));
                                                                                   ^~~~~~~
        |
    159 |         unwrap(PM)->add(createMemorySanitizerLegacyPassPass({trackOrigins, recover, kernel}));
        |                                                                     ^
    
    /private/var/folders/zg/mkwy5rhs06dbyf6rmxgrrb8w0000gn/T/stack6665/llvm-hs-9.0.0/src/LLVM/Internal/FFI/PassManagerC.cpp:159:69: error:
         note: insert an explicit cast to silence this issue
                unwrap(PM)->add(createMemorySanitizerLegacyPassPass({trackOrigins, recover, kernel}));
                                                                                   ^~~~~~~
                                                                                   static_cast<bool>( )
        |
    159 |         unwrap(PM)->add(createMemorySanitizerLegacyPassPass({trackOrigins, recover, kernel}));
        |                                                                     ^
    
    /private/var/folders/zg/mkwy5rhs06dbyf6rmxgrrb8w0000gn/T/stack6665/llvm-hs-9.0.0/src/LLVM/Internal/FFI/PassManagerC.cpp:159:78: error:
         error: non-constant-expression cannot be narrowed from type 'LLVMBool' (aka 'int') to 'bool' in initializer list [-Wc++11-narrowing]
                unwrap(PM)->add(createMemorySanitizerLegacyPassPass({trackOrigins, recover, kernel}));
                                                                                            ^~~~~~
        |
    159 |         unwrap(PM)->add(createMemorySanitizerLegacyPassPass({trackOrigins, recover, kernel}));
        |                                                                              ^
    
    /private/var/folders/zg/mkwy5rhs06dbyf6rmxgrrb8w0000gn/T/stack6665/llvm-hs-9.0.0/src/LLVM/Internal/FFI/PassManagerC.cpp:159:78: error:
         note: insert an explicit cast to silence this issue
                unwrap(PM)->add(createMemorySanitizerLegacyPassPass({trackOrigins, recover, kernel}));
                                                                                            ^~~~~~
                                                                                            static_cast<bool>( )
        |
    159 |         unwrap(PM)->add(createMemorySanitizerLegacyPassPass({trackOrigins, recover, kernel}));
        |                                                                              ^
    2 errors generated.
    `gcc' failed in phase `C Compiler'. (Exit code: 1)

I installed llvm-9

> brew install llvm-hs/llvm/llvm-9
> llvm-config --version
9.0.0

Seems I'm missing https://github.com/llvm-hs/llvm-hs/pull/279/commits/715a33016d53390323e49eaad9ca8db97242ab72, but I don't know how to get it.

xhliu avatar Apr 21 '20 18:04 xhliu