Added optimizations for combining conditions together when their results are OR'ed
Added recognition of impossible comparisons via NZM and optimize them away Recognize (x + -y) and transform to (x - y) for constants Recognize (~x ) + 1 and transform to -x Check and transform comparisons if theyre semantically equal to others Detect comparisons of single-bit values with their only possible non-zero value and transform to true/false tests Transform ==0 to IS_FALSE, !=0 to IS_TRUE Truncate to int8 if operand for IS_TRUE/IS_FALSE has a nzm of 1 Reduced code generated for SubDidCarry slightly Add special case for InstrEmit_srawix if mask == 1 Cut down the code generated for trap instructions, instead of naive or'ing or compare results do a switch and select the best condition Rerun simplification pass until no changes, as some optimizations will enable others to be done Enable rel32 call optimization by default
This commit is contained in:
@@ -34,9 +34,17 @@ class SimplificationPass : public ConditionalGroupSubpass {
|
||||
bool SimplifyBitArith(hir::HIRBuilder* builder);
|
||||
// handle either or or xor with 0
|
||||
bool CheckOrXorZero(hir::Instr* i);
|
||||
bool CheckOr(hir::Instr* i);
|
||||
bool CheckXor(hir::Instr* i);
|
||||
bool CheckAnd(hir::Instr* i);
|
||||
bool CheckOr(hir::Instr* i, hir::HIRBuilder* builder);
|
||||
bool CheckXor(hir::Instr* i, hir::HIRBuilder* builder);
|
||||
bool CheckAnd(hir::Instr* i, hir::HIRBuilder* builder);
|
||||
bool CheckAdd(hir::Instr* i, hir::HIRBuilder* builder);
|
||||
bool CheckSelect(hir::Instr* i, hir::HIRBuilder* builder,
|
||||
hir::Value* condition, hir::Value* iftrue,
|
||||
hir::Value* iffalse);
|
||||
bool CheckSelect(hir::Instr* i, hir::HIRBuilder* builder);
|
||||
bool CheckScalarConstCmp(hir::Instr* i, hir::HIRBuilder* builder);
|
||||
bool CheckIsTrueIsFalse(hir::Instr* i, hir::HIRBuilder* builder);
|
||||
|
||||
static bool Is1BitOpcode(hir::Opcode def_opcode);
|
||||
static uint64_t GetScalarNZM(hir::Value* value, hir::Instr* def,
|
||||
uint64_t typemask, hir::Opcode def_opcode);
|
||||
|
||||
Reference in New Issue
Block a user