[PATCH] D51215: Fix misfolding of IRBuilder.CreateICmp(int_ty X, bitcast (float_ty Y) to int_ty)

Andrew Scheidecker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 13 04:05:46 PST 2019


AndrewScheidecker added a comment.

> This took some work, but I have an IR test case that should show the bug:
>  rL353883 <https://reviews.llvm.org/rL353883>

Nice!

> I haven't looked at D51216 <https://reviews.llvm.org/D51216> yet, so this might be a dumb question, but is there an fcmp sibling to this bug?

There doesn't seem to be. I wrote a fcmp equivalent to the test you added to bitcast.ll in rL353883 <https://reviews.llvm.org/rL353883>, and it behaved as expected.



================
Comment at: unittests/IR/IRBuilderTest.cpp:679
+  // fp->int bitcast.
+  auto F32TimesTwo = Builder.CreateAdd(F32, F32);
+  auto I32 = Builder.CreateBitCast(F32TimesTwo, I32Type);
----------------
spatel wrote:
> This means that IRBuilder has a bug/opportunity to be stricter? How did we create an integer add with FP operands?
Oops, that should be CreateFAdd. It looks like this would trigger an assertion on a NDEBUG build. But should I keep this test if it's redundant with the IR test case you added?


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D51215/new/

https://reviews.llvm.org/D51215





More information about the llvm-commits mailing list