[InstCombine] use ConstantExpr::getBitCast() instead of creating useless instruction

llvm-svn: 274229
This commit is contained in:
Sanjay Patel 2016-06-30 14:27:41 +00:00
parent 7ad98babfa
commit 4520d9a1f5
1 changed files with 1 additions and 2 deletions

View File

@ -1219,8 +1219,7 @@ Instruction *InstCombiner::foldCastedBitwiseLogic(BinaryOperator &I) {
Value *BC = nullptr;
Constant *C = nullptr;
if ((match(Op0, m_BitCast(m_Value(BC))) && match(Op1, m_Constant(C)))) {
// A bitcast of a constant will be removed.
Value *NewConstant = Builder->CreateBitCast(C, SrcTy);
Value *NewConstant = ConstantExpr::getBitCast(C, SrcTy);
Value *NewOp = Builder->CreateBinOp(LogicOpc, BC, NewConstant, I.getName());
return CastInst::CreateBitOrPointerCast(NewOp, DestTy);
}