[InferAddressSpaces] NFC: For noop IntToPtr/PtrToInt pair cast to operator instead...
authorReshabh Sharma <Reshabhkumar.Sharma@amd.com>
Mon, 28 Jun 2021 13:48:39 +0000 (19:18 +0530)
committerReshabh Sharma <Reshabhkumar.Sharma@amd.com>
Mon, 28 Jun 2021 13:54:26 +0000 (19:24 +0530)
commitae983de6cce23dfeeb629395f86528e911218ba4
tree0de39f39d16786f5cba9d50fb241ac70a42004f0
parent13b2fba2398d433a5f5f9534c737c434dfb0c7b3
[InferAddressSpaces] NFC: For noop IntToPtr/PtrToInt pair cast to operator instead of PtrToInt

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.

Differential Revision: https://reviews.llvm.org/D105002
llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
llvm/test/Transforms/InferAddressSpaces/AMDGPU/noop-ptrint-pair.ll