Skip to content

Commit

Permalink
Do not generate unnecessary allocas for logical and bitwise not opera…
Browse files Browse the repository at this point in the history
…tors (#714)
  • Loading branch information
marcauberer authored Jan 18, 2025
1 parent c739d58 commit 0a5692d
Show file tree
Hide file tree
Showing 4 changed files with 256 additions and 280 deletions.
12 changes: 0 additions & 12 deletions src/irgenerator/GenExpressions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,12 +660,6 @@ std::any IRGenerator::visitPrefixUnaryExpr(const PrefixUnaryExprNode *node) {
// Execute operation
lhs = conversionManager.getPrefixNotInst(node, lhs, lhsSTy);

// This operator can not work in-place, so we need additional memory
lhs.ptr = insertAlloca(lhs.value->getType());

// Store the new value
insertStore(lhs.value, lhs.ptr, lhs.entry && lhs.entry->isVolatile);

break;
}
case PrefixUnaryExprNode::OP_BITWISE_NOT: {
Expand All @@ -675,12 +669,6 @@ std::any IRGenerator::visitPrefixUnaryExpr(const PrefixUnaryExprNode *node) {
// Execute operation
lhs = conversionManager.getPrefixBitwiseNotInst(node, lhs, lhsSTy);

// This operator can not work in-place, so we need additional memory
lhs.ptr = insertAlloca(lhs.value->getType());

// Store the new value
insertStore(lhs.value, lhs.ptr, lhs.entry && lhs.entry->isVolatile);

break;
}
case PrefixUnaryExprNode::OP_DEREFERENCE: {
Expand Down
Loading

0 comments on commit 0a5692d

Please sign in to comment.