use Constant::getAggregateElement to simplify a bunch of code.

llvm-svn: 148934
5 files changed