[PATCH] Fix a mergefunc crash caused by bitcasting intrinsics

Stepan Dyatkovskiy stpworld at narod.ru
Tue Apr 22 22:52:11 PDT 2014

Dotdash, thank you for working on it!

For merge functions side this check looks right to me.
So, once you realized V1 != V2, and:
-- One of them is Function.
-- Even if both of V1 and V2 are functions, actually, we have no proper way to detect whether those are definitions of the same function.
Well, IMHO, its OK, to return false.

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?

I'm not sure how it could be done. May be like this:
1. File new bug for getBitCast method.
2. I'd propose to cut off MergeFunctions dependency from #1, and commit Dotdash's patch. I also suspect it could take a really long time to localize #1, then fix it, and then get LGTM.


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

More information about the llvm-commits mailing list