egraph opts: fix uextend-of-i32. (#5061)
This is a simple error in the const-prop rules: uextend was not masking iconst's u64 immediate when extending from i32 to i64. Arguably an iconst.i32 should not have nonzero bits in the upper 32 of its immediate, but that's a separate design question. For now, if our invariant is that the upper bits are ignored, then it is required to mask the bits when const-evaling a `uextend`. Fixes #5047.
This commit is contained in:
@@ -95,6 +95,11 @@ macro_rules! isle_common_prelude_methods {
|
||||
Some(x as u32 as i32 as i64 as u64)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn u64_uextend_u32(&mut self, x: u64) -> Option<u64> {
|
||||
Some(x & 0xffff_ffff)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn ty_bits(&mut self, ty: Type) -> Option<u8> {
|
||||
use std::convert::TryInto;
|
||||
|
||||
Reference in New Issue
Block a user