[PATCH] D77977: [InstCombine] Simplify calls with casted "returned" attribute
Johannes Doerfert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 13 08:34:35 PDT 2020
jdoerfert marked an inline comment as done.
jdoerfert added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:4660
+ Type *RetArgTy = ReturnedArg->getType();
+ if (RetArgTy->canLosslesslyBitCastTo(CallTy))
+ return replaceInstUsesWith(
----------------
lebedev.ri wrote:
> nikic wrote:
> > lebedev.ri wrote:
> > > I can't imagine it matters, but these should be swapped around.
> > Shouldn't this be an assertion rather than an if check?
> Is there a verifier check for that?
@nikic has a point. To fix the issue we just need the `CreateBitOrPointerCast`, anything that is not valid is an error in the IR.
@lebedev.ri are you sure wrt. the order.We cast the returned argument to the call type so I figured we want to know if the returned argument type can be casted to the call return type.
I think I'll update with an assertion.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77977/new/
https://reviews.llvm.org/D77977
More information about the llvm-commits
mailing list