Hendrik Boom
2008-Jun-09 14:29 UTC
[LLVMdev] regression? Or did I do something wrong again?
I don't know if the toy program in chapter 4 of the tutorial implementing Kaleidoscope in llvm with C++ is part of your regression suite, but with the version of llvm I installed last weekend, it does not compile: hendrik at lovesong:~/dv/llvm/tut$ g++ -g toy.cpp `llvm-config --cppflags --ldflags --libs core jit native` -O3 -o toy toy.cpp: In member function ‘virtual llvm::Value* NumberExprAST::Codegen()’: toy.cpp:359: error: no matching function for call to ‘llvm::ConstantFP::get(const llvm::Type*&, llvm::APFloat)’ /usr/local/llvm/include/llvm/Constants.h:237: note: candidates are: static llvm::ConstantFP* llvm::ConstantFP::get(const llvm::APFloat&) /usr/local/llvm/include/llvm/Constants.h:242: note: static llvm::ConstantFP* llvm::ConstantFP::get(const llvm::Type*, double) hendrik at lovesong:~/dv/llvm/tut$ I cut-and-pasted the sourse from http://llvm.org/docs/tutorial/LangImpl4.html -- hendrik
Jonathan Turner
2008-Jun-09 18:34 UTC
[LLVMdev] regression? Or did I do something wrong again?
----------------------------------------> To: llvmdev at cs.uiuc.edu > > hendrik at lovesong:~/dv/llvm/tut$ g++ -g toy.cpp `llvm-config --cppflags --ldflags --libs core jit native` -O3 -o toy > toy.cpp: In member function ‘virtual llvm::Value* NumberExprAST::Codegen()’: > toy.cpp:359: error: no matching function for call to ‘llvm::ConstantFP::get(const llvm::Type*&, llvm::APFloat)’ > /usr/local/llvm/include/llvm/Constants.h:237: note: candidates are: static llvm::ConstantFP* llvm::ConstantFP::get(const llvm::APFloat&) > /usr/local/llvm/include/llvm/Constants.h:242: note: static llvm::ConstantFP* llvm::ConstantFP::get(const llvm::Type*, double) > hendrik at lovesong:~/dv/llvm/tut$I had the same issue. I think the tutorial is a little out of date. If you pass in just the raw double instead of wrapping it with the APFloat call, it should work fine. Jonathan _________________________________________________________________ It’s easy to add contacts from Facebook and other social sites through Windows Live™ Messenger. Learn how. https://www.invite2messenger.net/im/?source=TXT_EML_WLH_LearnHow
Duncan Sands
2008-Jun-09 18:52 UTC
[LLVMdev] regression? Or did I do something wrong again?
> I don't know if the toy program in chapter 4 of the tutorial > implementing Kaleidoscope in llvm with C++ is part of your > regression suite, but with the version of llvm I installed > last weekend, it does not compile:Does it work with the 2.3 release? The web-page docs refer to what's in svn (which is basically the same as 2.3 right now). Ciao, Duncan.
Eli Friedman
2008-Jun-09 19:06 UTC
[LLVMdev] regression? Or did I do something wrong again?
On Mon, Jun 9, 2008 at 7:29 AM, Hendrik Boom <hendrik at topoi.pooq.com> wrote:> I don't know if the toy program in chapter 4 of the tutorial > implementing Kaleidoscope in llvm with C++ is part of your > regression suiteIt isn't (although that might be a good idea).> but with the version of llvm I installed > last weekend, it does not compile: > > hendrik at lovesong:~/dv/llvm/tut$ g++ -g toy.cpp `llvm-config --cppflags --ldflags --libs core jit native` -O3 -o toy > toy.cpp: In member function 'virtual llvm::Value* NumberExprAST::Codegen()': > toy.cpp:359: error: no matching function for call to 'llvm::ConstantFP::get(const llvm::Type*&, llvm::APFloat)' > /usr/local/llvm/include/llvm/Constants.h:237: note: candidates are: static llvm::ConstantFP* llvm::ConstantFP::get(const llvm::APFloat&) > /usr/local/llvm/include/llvm/Constants.h:242: note: static llvm::ConstantFP* llvm::ConstantFP::get(const llvm::Type*, double) > hendrik at lovesong:~/dv/llvm/tut$ > > I cut-and-pasted the sourse from http://llvm.org/docs/tutorial/LangImpl4.htmlThat should be easy to fix; from the LLVM 2.3 release notes: "The ConstantFP::get method that uses APFloat now takes one argument instead of two. The type argument has been removed, and the type is now inferred from the size of the given APFloat value." So to make it compile, "ConstantFP::get(Type::DoubleTy, APFloat(Val));" needs to be changed to "ConstantFP::get(APFloat(Val));". -Eli
Matthijs Kooijman
2008-Jun-09 19:25 UTC
[LLVMdev] regression? Or did I do something wrong again?
Hi Hendrik,> hendrik at lovesong:~/dv/llvm/tut$ g++ -g toy.cpp `llvm-config --cppflags --ldflags --libs core jit native` -O3 -o toy > toy.cpp: In member function ‘virtual llvm::Value* NumberExprAST::Codegen()’: > toy.cpp:359: error: no matching function for call to ‘llvm::ConstantFP::get(const llvm::Type*&, llvm::APFloat)’ > /usr/local/llvm/include/llvm/Constants.h:237: note: candidates are: static llvm::ConstantFP* llvm::ConstantFP::get(const llvm::APFloat&) > /usr/local/llvm/include/llvm/Constants.h:242: note: static llvm::ConstantFP* llvm::ConstantFP::get(const llvm::Type*, double) > hendrik at lovesong:~/dv/llvm/tut$It seems the ConstantFP method get might have been modified to take a reference-to-APFloat, meaning you can't pass in APFloat(Value) anonymously. You should either put it in a local variable, like APFloat F(Val); return ConstantFP::get(Type::DoubleTy, F); which I _think_ is the right way to use the first get() function. Easier is to use the alternative get() function, which simply takes a double directly. i.e., return ConstantFP::get(Type::DoubleTy, Val); Could you please test both and report the results? Gr. Matthijs -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: Digital signature URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080609/8579b3d7/attachment.sig>
Hendrik Boom
2008-Jun-09 23:45 UTC
[LLVMdev] regression? Or did I do something wrong again?
On Mon, 09 Jun 2008 20:52:44 +0200, Duncan Sands wrote:>> I don't know if the toy program in chapter 4 of the tutorial >> implementing Kaleidoscope in llvm with C++ is part of your >> regression suite, but with the version of llvm I installed >> last weekend, it does not compile: > > Does it work with the 2.3 release? The web-page docs refer > to what's in svn (which is basically the same as 2.3 right > now).It was the version from svn that I installed. If the tutorial is to be released with llvm (and it probably should be), you'd better update the code in it before the release. Otherwise you'll make a lot of new users as confused as me. -- hendrik
Hendrik Boom
2008-Jun-09 23:51 UTC
[LLVMdev] regression? Or did I do something wrong again?
On Mon, 09 Jun 2008 12:06:19 -0700, Eli Friedman wrote:> > That should be easy to fix; from the LLVM 2.3 release notes: "The > ConstantFP::get method that uses APFloat now takes one argument > instead of two. The type argument has been removed, and the type is > now inferred from the size of the given APFloat value." So to make it > compile, "ConstantFP::get(Type::DoubleTy, APFloat(Val));" needs to be > changed to "ConstantFP::get(APFloat(Val));". > > -EliAnd removing the first argument in toy.cpp program does indeed make it work. -- hendrik
Hendrik Boom
2008-Jun-10 00:17 UTC
[LLVMdev] regression? Or did I do something wrong again?
On Mon, 09 Jun 2008 21:25:42 +0200, Matthijs Kooijman wrote:> Hi Hendrik, >> It seems the ConstantFP method get might have been modified to take a > reference-to-APFloat, meaning you can't pass in APFloat(Value) anonymously. > You should either put it in a local variable, like > APFloat F(Val); > return ConstantFP::get(Type::DoubleTy, F); > which I _think_ is the right way to use the first get() function. Easier is to > use the alternative get() function, which simply takes a double directly. > i.e., > return ConstantFP::get(Type::DoubleTy, Val); > > Could you please test both and report the results? >Eli Friedman tells me that the specs for ConstantFP have changed. In the release notes it now tells us that the first argument has been dropped entirely. Given the change of spec, there isn't much point in doing your tests; but removing the first argument from the offending call works wonders. Someone with write access should correct the tutorial! -- hendrik
Reasonably Related Threads
- [LLVMdev] regression? Or did I do something wrong again?
- [LLVMdev] regression? Or did I do something wrong again?
- [LLVMdev] regression? Or did I do something wrong again?
- [LLVMdev] Having JIT resolve extern "C" functions declared in executible
- [LLVMdev] Error while linking LLVM files