As metioned in https://reviews.llvm.org/D34576, checkings in
collectConstantCandidates can be replaced by using
llvm::canReplaceOperandWithVariable.
The only special case is that collectConstantCandidates return false for
all IntrinsicInst but it is safe for us to collect constant candidates from
IntrinsicInst.
Should canReplaceOperandWithVariable be checking for inline asm?