Refactor from iteratively using BitCastInst::getOperand() to using stripPointerCasts() instead. This is an improvement since now we are able to analyze more cases, please refer to test cases added in this patch.
After this patch, I will update the same piece of code in https://reviews.llvm.org/D122857 correspondingly.
No If-condition needed, stripPointerCasts will return itself if not strippable.