[llvm] kaleidoscope: add missing check in the FunctionAST::codegen (PR #76322)

Amila Senadheera via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 18 05:51:21 PST 2025


Amila-Rukshan wrote:

@TiborGY, Yes, it builds and runs fine. gives the intended error when trying to redefine a function as below:
```
ready> def bar(a) foo(a, 4.0) + bar(31337);
ready> Read function definition:define double @bar(double %a) {
entry:
  %calltmp = call double @foo(double %a, double 4.000000e+00)
  %calltmp1 = call double @bar(double 3.133700e+04)
  %addtmp = fadd double %calltmp, %calltmp1
  ret double %addtmp
}

ready> def bar(a) foo(a, 4.0) + bar(31337);
ready> Error: Function cannot be redefined.
ready> 
```

https://github.com/llvm/llvm-project/pull/76322


More information about the llvm-commits mailing list