mirror of
https://github.com/EmbarkStudios/rust-gpu.git
synced 2025-02-16 17:04:16 +00:00
Fix bug with mem2reg store valid variable detection
This commit is contained in:
parent
919b320d32
commit
64e0f664e0
@ -193,11 +193,13 @@ fn collect_access_chains(
|
||||
loop {
|
||||
let mut changed = false;
|
||||
for inst in blocks.iter().flat_map(|b| &b.instructions) {
|
||||
for op in &inst.operands {
|
||||
for (index, op) in inst.operands.iter().enumerate() {
|
||||
if let Operand::IdRef(id) = op {
|
||||
if variables.contains_key(id) {
|
||||
match inst.class.opcode {
|
||||
Op::Load | Op::Store | Op::AccessChain | Op::InBoundsAccessChain => {}
|
||||
// Only allow store if pointer is the lhs, not rhs
|
||||
Op::Store if index == 0 => {}
|
||||
Op::Load | Op::AccessChain | Op::InBoundsAccessChain => {}
|
||||
_ => return None,
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user