[PATCH] D25265: [C API] Add test for D25259 and new LLVMIsExact function.

Mehdi AMINI via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 5 08:38:39 PDT 2016


mehdi_amini added a comment.



In https://reviews.llvm.org/D25265#562258, @mjacob wrote:

> - It adds a new C API function (`LLVMIsExact`) which I don't really care about other than for writing this test.
> - It's asymmetric (e.g. missing something like `LLVMSetIsExact`). @deadalnix pointed this out as well.


The general question I'd have would be: isn't the ability to round-trip something that is "useful" in general with the C API?
If yes then it seems that the test helped identified the missing `LLVMIsExact`, and it is legit.
Otherwise yeah it isn't great to add API just for being able to fit the testing infrastructure and fit other APIs.

> - LLVMConstExactUDiv is still untested.

Can't you round-trip the following?

  @foo = external global i8
  define i64 @test() {
    ret i64 udiv exact (i64 ptrtoint (i8* @foo to i64), i64 10)
  }



> I think we need a different approach for testing the C API. Something like calling a bunch of C API functions, dumping the module and checking it with FileCheck.

I'd be fine with that, but do we have the infrastructure for it?


https://reviews.llvm.org/D25265





More information about the llvm-commits mailing list