-
Notifications
You must be signed in to change notification settings - Fork 13.4k
LoopFullUnrollPass failed due to constant inference in opaque pointer mode. #65763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Could you share the LLVM IR before the SLP vectorizer? |
There are two smaller IRs: But I dont's see the value. See #65764 (comment). |
I added an IR that looks pretty good in #65875. |
Closes #65763. This will provide more opportunities for constant propagation for subsequent optimizations.
Hey @dianqk, it appears that after 2d1e8a0, one of rust's codegen tests started failing: The test code looks like this: https://github.com/rust-lang/rust/blob/ed33e408c5299b4c1fd87a37e050180db9d642d5/tests/codegen/simd/simd-wide-sum.rs#L52-L59 #[no_mangle]
// CHECK-LABEL: @wider_reduce_into_iter
pub fn wider_reduce_into_iter(x: Simd<u8, N>) -> u16 {
// CHECK: zext <8 x i8>
// CHECK-SAME: to <8 x i16>
// CHECK: call i16 @llvm.vector.reduce.add.v8i16(<8 x i16>
x.to_array().into_iter().map(u16::from).sum()
} With 2d1e8a0, it looks like now the code is exploded into a long sequence that doesn't call llvm vector anymore: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/22405#018aafae-043a-4a37-86ef-02493663ee73/689-740:
I suspect that this may be a potential regression since the other related functions in this test still expand to short sequences that use llvm.vector as expected, e.g.:
|
I'm sorry for the trouble. I'm not sure yet. But I'll look into it tomorrow. If this blocks something, you can revert this commit |
This regression is expected (we've hit it before, see #55693). You can adjust the codegen test. |
Yes. I close this issue. The new one is vectorize-related. |
I tried to disable the opaque pointer in rust-lang/rust#115339 to get the SLPVectorizer optimization.
See https://godbolt.org/z/GqdPGarsn.
According to my investigation, the success of optimization in non-opaque pointer mode relates to SROA.cpp#L1831-L1845 or InstructionCombining.cpp#L2220-L2274. Unfortunately, these two transformations have been removed during opaque pointer migration.
My plan is to restore the behavior of InstructionCombining.cpp#L2220-L2274 using
alloc
instead ofbitcast
.Looking at the code comments, this seems to be an important optimization. So it might be worth backporting to LLVM 17?
The text was updated successfully, but these errors were encountered: