[llvm-dev] Problems with IR Builder

James Courtier-Dutton via llvm-dev llvm-dev at lists.llvm.org
Sat Apr 29 02:21:36 PDT 2017


I am finding that I can happily add this instruction to with the IR Builder API.
%reg010 = add i32 %reg007, i64 %reg001

Then when I do a "verify" pass I get this:
Both operands to a binary operator are not of the same type!
  %reg010 = add i32 %reg007, i64 %reg001

Now, why doesn't it catch this error when I add the instruction,
instead of waiting till the verify pass to catch it?

I have found other cases, where it passes the verify pass, I can write
the .bc bitcode to a file.
Then when I use llvm-dis  to convert the .bc to .ll format, llvm-dis
fails to load it.
So, why aren't the tests done at the "verify" pass the same as the
tests done by llvm-dis ?

I need my program to have sufficient tests in it to ensure that
whatever bitcode it tries to write, it will be valid bitcode that can
be read by all other llvm tools.
I.e. I wish to catch the error at creation time.

Is this expected behaviour, or a bug?

Kind Regards


More information about the llvm-dev mailing list