mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-13 06:06:27 +00:00
Make CreateBinOp/CreateNeg/CreateNot do constant folding.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53950 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
967948b4e2
commit
fcf0e86bf2
@ -243,15 +243,22 @@ public:
|
||||
return Insert(BinaryOperator::CreateXor(LHS, RHS), Name);
|
||||
}
|
||||
|
||||
BinaryOperator *CreateBinOp(Instruction::BinaryOps Opc,
|
||||
Value *LHS, Value *RHS, const char *Name = "") {
|
||||
Value *CreateBinOp(Instruction::BinaryOps Opc,
|
||||
Value *LHS, Value *RHS, const char *Name = "") {
|
||||
if (Constant *LC = dyn_cast<Constant>(LHS))
|
||||
if (Constant *RC = dyn_cast<Constant>(RHS))
|
||||
return ConstantExpr::get(Opc, LC, RC);
|
||||
return Insert(BinaryOperator::Create(Opc, LHS, RHS), Name);
|
||||
}
|
||||
|
||||
BinaryOperator *CreateNeg(Value *V, const char *Name = "") {
|
||||
Value *CreateNeg(Value *V, const char *Name = "") {
|
||||
if (Constant *VC = dyn_cast<Constant>(V))
|
||||
return ConstantExpr::getNeg(VC);
|
||||
return Insert(BinaryOperator::CreateNeg(V), Name);
|
||||
}
|
||||
BinaryOperator *CreateNot(Value *V, const char *Name = "") {
|
||||
Value *CreateNot(Value *V, const char *Name = "") {
|
||||
if (Constant *VC = dyn_cast<Constant>(V))
|
||||
return ConstantExpr::getNot(VC);
|
||||
return Insert(BinaryOperator::CreateNot(V), Name);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user