Patch to fix BrainF runtime assertion failure

Hi all,

I downloaded LLVM to play with today and found that the BrainF example
compiler fails with an assertion error like so:

examples$ ./BrainF -jit /tmp/test.bf
BrainF: Instructions.cpp:242: void llvm::CallInst::init(llvm::Value*, llvm::Value* const*, unsigned int): Assertion `(NumParams == FTy->getNumParams() || (FTy->isVarArg() && NumParams > FTy->getNumParams())) && "Calling a function with bad signature!"' failed.
Aborted

I tracked this down to bad arguments passed to the memset intrinsic.

From the svn logs it looks like the memset intrinsic was given a new

prototype in April and the BrainF code hasn't been updated for this
yet. This patch fixes the bug and the demo BF code I ran on it works
perfectly now.

Could someone apply this for me, please?

Dan Hipschman

BrainF.patch (1.21 KB)

I just realized I didn't fix up the comments completely. Here's an
identical patch plus two comment to reference the new intrinsic
suffix.

BrainF.patch (1.28 KB)

Thanks! Applied in r110735,

-Chris