eval: remove incorrect truncate ops

This commit is contained in:
Ryan Fleury
2026-04-15 12:07:14 -07:00
parent 7106265a14
commit 6a36382690
2 changed files with 4 additions and 16 deletions
+1 -16
View File
@@ -228,19 +228,8 @@ e_irtree_mem_read_type(Arena *arena, E_IRNode *c, E_TypeKey type_key)
read_node->value.u64 = byte_size;
e_irnode_push_child(read_node, c);
// rjf: build a signed trunc node if needed
U64 bit_size = byte_size << 3;
E_IRNode *with_trunc = read_node;
E_TypeKind kind = e_type_kind_from_key(type_key);
if(bit_size < 64 && e_type_kind_is_signed(kind))
{
with_trunc = e_push_irnode(arena, RDI_EvalOp_TruncSigned);
with_trunc->value.u64 = bit_size;
e_irnode_push_child(with_trunc, read_node);
}
// rjf: fill
result = with_trunc;
result = read_node;
return result;
}
@@ -898,10 +887,6 @@ e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, E_I
{
new_tree = e_irtree_trunc(arena, in_tree, cast_type);
}
if(e_type_kind_is_signed(cast_type_unwrapped_kind) && e_type_kind_is_integer(casted_type_unwrapped_kind) && !e_type_kind_is_signed(casted_type_unwrapped_kind))
{
new_tree = e_irtree_trunc(arena, in_tree, cast_type);
}
result.root = new_tree;
result.type_key = cast_type;
result.mode = E_Mode_Value;
+3
View File
@@ -413,6 +413,9 @@ type_coverage_eval_tests(void)
uint32_t a = (1<<31);
int32_t b = (1<<31);
uint32_t abcd = 0xaabbccdd;
int64_t abcd64 = (int64_t)abcd;
char string[] = "Hello World!";
char longer_text[] =
"Suppose there was some text\n"