Comments (3)
FYI @jwong101
from rust.
@rustbot claim
from rust.
After taking a look at this, the problem seems to be that GVN isn't propagating the pointer equalities in the following IR after this PR:
define void @src(ptr noundef %buf, ptr noundef %start, ptr noundef %end) {
bb2:
%iter.exhausted = icmp eq ptr %end, %start
br i1 %iter.exhausted, label %bb5, label %bb3
bb3: ; preds = %bb2
%iter.empty.loop = icmp eq ptr %end, %buf
br i1 %iter.empty.loop, label %bb5, label %exit
bb5: ; preds = %bb2, %bb3
%self.end = phi ptr [ %buf, %bb3 ], [ %start, %bb2 ]
;%self.end = phi ptr [ %end %bb3 ], [ %end %bb2 ] <- gvn used to propogate this
%_710.i.i = icmp eq ptr %end, %self.end
br i1 %_710.i.i, label %exit, label %bb6
bb6: ; preds = %bb5
%inner.cap = load i64, ptr %self.end, align 8, !noundef !0
call void @effect(i64 %inner.cap)
br label %exit
exit: ; preds = %bb3, %bb5, %bb6
ret void
}
define void @tgt(ptr noundef %buf, ptr noundef %start, ptr noundef %end) {
ret void
}
Before, GVN would blindly propagate %end
to each operand of %self.end
. Just doing that is incorrect, since there's a load of %self.end
, which might not have the same provenance as the replaced pointer.
However, it should be sound to propagate pointer equality to just comparisons, which the PR does when the only uses are icmp or ptrtoint
instructions or phi
and select
instructions that feed into them.
Unfortunately, this doesn't help in our case, since the phi node is also used by a load. My naive idea would be to either create duplicate phi nodes that are only used by ptrtoint
or icmp
, so we can propagate equality there or store pointer equality information about the phi node in some side table and replace only icmp and ptrtoint uses if all of the phi node operands turn out to be equivalent.
There's probably a better way, as I'm not that familiar with LLVM's GVNpass. Is there another approach I could take for solving the above problem; should I be looking at another pass?
from rust.
Related Issues (20)
- Tracking Issue for `os_string_pathbuf_leak` HOT 1
- Compiler error while compiling iroh HOT 1
- bulid panic HOT 2
- `dropping_references` lint triggers even for mutable references HOT 11
- rustdoc-json-types: Use different repr for Constant in Item and Type position HOT 3
- ConstContext::Maybe must have host effect param HOT 1
- Stabilization PR HOT 1
- Tracking Issue for XXX
- Expand list of trait implementers in E0277 when calling `rustc` with `--verbose` HOT 2
- keyword-idents-2024 unable to migrate loop labels or lifetimes HOT 3
- rustdoc: Consider ways to make UI development cycle faster HOT 7
- ICE: `polonius loan scopes differ from NLL borrow scopes` HOT 6
- rustdoc: search for type alias says "type X not found, showing type X instead"
- Very bad performance of `cargo check` on generic code HOT 5
- Suggest changing `main`s return type on E0277 (`?` / `from_residual`)
- Inefficient codegen collecting slice iterator into array HOT 3
- nightly: Trait resolution picks the wrong trait impl with higher ranked bounds HOT 8
- llvm error: `SmallVector unable to grow. Requested capacity (4294967296) is larger than maximum value for size type (4294967295)` HOT 3
- optimize enum of #[repr(int)] enums with non-overlapping discriminants to just use inner discriminant HOT 3
- Missing optimized MIR for an item HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust.