We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
ForwardSwitchConditionToPHI
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
I tried this IR:
define { i64, i64 } @src(i64 noundef %arg, i64 noundef %arg1) local_unnamed_addr #0 { bb: switch i64 %arg1, label %bb7 [ i64 0, label %bb3 i64 1, label %bb2 ] bb2: ; preds = %bb br label %bb3 bb7: ; preds = %bb %i8 = udiv i64 %arg, %arg1 %i13 = shl nuw i64 %i8, 1 br label %bb3 bb3: ; preds = %bb7, %bb2, %bb %i = phi i64 [ %i13, %bb7 ], [ %arg, %bb2 ], [ undef, %bb ] %i4 = phi i64 [ 1, %bb7 ], [ 1, %bb2 ], [ %arg1, %bb ] %i5 = insertvalue { i64, i64 } poison, i64 %i4, 0 %i6 = insertvalue { i64, i64 } %i5, i64 %i, 1 ret { i64, i64 } %i6 }
We can replace [ 1, %bb2 ] with [ %arg1, %bb2 ]. Then the final IR will become to:
[ 1, %bb2 ]
[ %arg1, %bb2 ]
define { i64, i64 } @tgt(i64 noundef %arg, i64 noundef %arg1) { bb: %switch = icmp ult i64 %arg1, 2 br i1 %switch, label %bb3, label %bb7 bb7: ; preds = %bb %i8 = udiv i64 %arg, %arg1 %i13 = shl nuw i64 %i8, 1 br label %bb3 bb3: ; preds = %bb, %bb7 %i = phi i64 [ %i13, %bb7 ], [ %arg, %bb ] %i4 = phi i64 [ 1, %bb7 ], [ %arg1, %bb ] %i5 = insertvalue { i64, i64 } poison, i64 %i4, 0 %i6 = insertvalue { i64, i64 } %i5, i64 %i, 1 ret { i64, i64 } %i6 }
Alive2: https://alive2.llvm.org/ce/z/HvwxHB. From: rust-lang/rust#126585.
The text was updated successfully, but these errors were encountered:
jmp
opt-level=s
[SimplifyCFG] Forward indirect switch condition value if it can help …
0c56fd0
…fold the PHI (#95932) Fixes #95919.
fe9ecc6
…fold the PHI (llvm#95932) Fixes llvm#95919.
911eb1c
dianqk
Successfully merging a pull request may close this issue.
Uh oh!
There was an error while loading. Please reload this page.
I tried this IR:
We can replace
[ 1, %bb2 ]
with[ %arg1, %bb2 ]
. Then the final IR will become to:Alive2: https://alive2.llvm.org/ce/z/HvwxHB.
From: rust-lang/rust#126585.
The text was updated successfully, but these errors were encountered: