[PATCH] Fix a mergefunc crash caused by bitcasting intrinsics

Björn Steinbrink bsteinbr at gmail.com
Tue Apr 22 23:10:26 PDT 2014


2014-04-23 7:52 GMT+02:00 Stepan Dyatkovskiy <stpworld at narod.ru>:
> I suspect this code:
>
>   C1 == ConstantExpr::getBitCast(const_cast<Constant*>(C2), C1->getType());
>
> We didn't expect it will return "true" for such bitcast (from "i8* @breaker(i8*)" to "i64 @llvm.bswap.i64(i64)". Those are different functions. Perhaps *this* is the real bug?

It doesn't return true. The bitcast is never actually emitted (I
checked the resulting IR when running with -disable-verify) and the
functions aren't merged. But AFAICT the bitcast is added to the list
of users of the intrinsic and that's enough for the verifier to
complain about it.

Another approach I initially had in mind was to modify
canLosslesslyBitCastTo to return false for intrinsics. Yet another
solution would be to destroy the bitcast instruction after the
comparison.

http://reviews.llvm.org/D3437

REPLY HANDLER ACTIONS
  Reply to comment, or !reject, !abandon, !reclaim, !resign, !rethink, !unsubscribe.






More information about the llvm-commits mailing list