mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 16:24:23 +00:00
make IRBuilder zap "X|0" and "X&-1" when building IR, this happens
during bitfield codegen and slows down -O0 compile times by making useless IR. rdar://7362516 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86006 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -390,15 +390,21 @@ public:
|
||||
return Insert(BinaryOperator::CreateAShr(LHS, RHS), Name);
|
||||
}
|
||||
Value *CreateAnd(Value *LHS, Value *RHS, const Twine &Name = "") {
|
||||
if (Constant *LC = dyn_cast<Constant>(LHS))
|
||||
if (Constant *RC = dyn_cast<Constant>(RHS))
|
||||
if (Constant *RC = dyn_cast<Constant>(RHS)) {
|
||||
if (isa<ConstantInt>(RC) && cast<ConstantInt>(RC)->isAllOnesValue())
|
||||
return LHS; // LHS & -1 -> LHS
|
||||
if (Constant *LC = dyn_cast<Constant>(LHS))
|
||||
return Folder.CreateAnd(LC, RC);
|
||||
}
|
||||
return Insert(BinaryOperator::CreateAnd(LHS, RHS), Name);
|
||||
}
|
||||
Value *CreateOr(Value *LHS, Value *RHS, const Twine &Name = "") {
|
||||
if (Constant *LC = dyn_cast<Constant>(LHS))
|
||||
if (Constant *RC = dyn_cast<Constant>(RHS))
|
||||
if (Constant *RC = dyn_cast<Constant>(RHS)) {
|
||||
if (RC->isNullValue())
|
||||
return LHS; // LHS | 0 -> LHS
|
||||
if (Constant *LC = dyn_cast<Constant>(LHS))
|
||||
return Folder.CreateOr(LC, RC);
|
||||
}
|
||||
return Insert(BinaryOperator::CreateOr(LHS, RHS), Name);
|
||||
}
|
||||
Value *CreateXor(Value *LHS, Value *RHS, const Twine &Name = "") {
|
||||
|
Reference in New Issue
Block a user