mirror of
https://github.com/EmbarkStudios/rust-gpu.git
synced 2024-11-25 08:14:12 +00:00
Fix mem2reg bugs
This commit is contained in:
parent
ab100e1904
commit
6323fc609f
@ -39,10 +39,12 @@ fn compute_idom(preds: &[Vec<usize>]) -> Vec<usize> {
|
||||
fn intersect(doms: &[Option<usize>], mut finger1: usize, mut finger2: usize) -> usize {
|
||||
// TODO: This may return an optional result?
|
||||
while finger1 != finger2 {
|
||||
while finger1 < finger2 {
|
||||
// Note: The comparisons here are inverted from the paper, because the paper uses
|
||||
// comparison to be postorder index. However, we have reverse postorder indices.
|
||||
while finger1 > finger2 {
|
||||
finger1 = doms[finger1].unwrap();
|
||||
}
|
||||
while finger2 < finger1 {
|
||||
while finger2 > finger1 {
|
||||
finger2 = doms[finger2].unwrap();
|
||||
}
|
||||
}
|
||||
@ -57,7 +59,10 @@ fn compute_idom(preds: &[Vec<usize>]) -> Vec<usize> {
|
||||
for node in 1..(preds.len()) {
|
||||
let mut new_idom: Option<usize> = None;
|
||||
for &pred in &preds[node] {
|
||||
new_idom = Some(new_idom.map_or(pred, |new_idom| intersect(&idom, pred, new_idom)));
|
||||
if idom[pred].is_some() {
|
||||
new_idom =
|
||||
Some(new_idom.map_or(pred, |new_idom| intersect(&idom, pred, new_idom)));
|
||||
}
|
||||
}
|
||||
// TODO: This may return an optional result?
|
||||
let new_idom = new_idom.unwrap();
|
||||
|
@ -9,5 +9,5 @@ cargo build
|
||||
export RUSTFLAGS="-Zcodegen-backend=$PWD/../target/debug/librustc_codegen_spirv.so"
|
||||
|
||||
pushd build_libcore_test
|
||||
SPIRV_VAL=1 cargo build -Z build-std=core --target spirv-unknown-unknown --release
|
||||
SPIRV_VAL=${SPIRV_VAL-1} cargo build -Z build-std=core --target spirv-unknown-unknown --release
|
||||
popd
|
||||
|
@ -158,7 +158,6 @@ fn do_spirv_val(sess: &Session, filename: &Path, dump_path: String) {
|
||||
let output = output.expect("spirv-val failed to execute");
|
||||
if !output.status.success() {
|
||||
let dump_path = Path::new(&dump_path);
|
||||
sess.err("wau");
|
||||
let mut err = sess.struct_err(&format!("spirv-val failed with {}", output.status));
|
||||
if !output.stdout.is_empty() {
|
||||
err.note(&String::from_utf8(output.stdout).unwrap());
|
||||
|
@ -61,7 +61,7 @@ pointer_addrspace!("physical_storage_buffer", PhysicalStorageBuffer, true);
|
||||
#[allow(non_camel_case_types)]
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[repr(simd)]
|
||||
pub struct f32x4(f32, f32, f32, f32);
|
||||
pub struct f32x4(pub f32, pub f32, pub f32, pub f32);
|
||||
|
||||
/// libcore requires a few external symbols to be defined:
|
||||
/// https://github.com/rust-lang/rust/blob/c2bc344eb23d8c1d18e803b3f1e631cf99926fbb/library/core/src/lib.rs#L23-L27
|
||||
|
Loading…
Reference in New Issue
Block a user