[llvm] r274229 - [InstCombine] use ConstantExpr::getBitCast() instead of creating useless instruction
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 30 07:27:41 PDT 2016
Author: spatel
Date: Thu Jun 30 09:27:41 2016
New Revision: 274229
URL: http://llvm.org/viewvc/llvm-project?rev=274229&view=rev
Log:
[InstCombine] use ConstantExpr::getBitCast() instead of creating useless instruction
Modified:
llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp?rev=274229&r1=274228&r2=274229&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp Thu Jun 30 09:27:41 2016
@@ -1219,8 +1219,7 @@ Instruction *InstCombiner::foldCastedBit
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);
}
More information about the llvm-commits
mailing list