Compiler crashes at an assertion while casting operands to PtrToIntInst at some cases when ptrtoint is present as an explicit operand to inttoptr. Explicit instruction operator as operand can not be casted to an Instruction.
This patch replaces cast from PtrToInst to Operator which are later checked for constant expressions.
Can't you access the operator operand anyway and still handle constant expressions?