-
Notifications
You must be signed in to change notification settings - Fork 9
pre-commit: PR173353 #3208
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
pre-commit: PR173353 #3208
Conversation
Diff moderunner: ariselab-64c-docker 5451 files changed, 17840834 insertions(+), 18262337 deletions(-) +10 c3c/llvm_codegen.ll |
|
This patch applies a series of LLVM IR optimizations across many benchmarks, primarily focusing on control-flow simplification, reduction of redundant code paths, and improved PHI node management. Below is a summary of the five major changes:
No formatting, renaming, or reordering changes were considered significant; the focus remains strictly on semantic control-flow and data-flow improvements. model: qwen-plus-latest |
| llvm_emit_memcpy.exit: ; preds = %10, %.sink.split.i | ||
| %.0.sink.i = phi i32 [ %26, %.sink.split.i ], [ %22, %10 ] | ||
| %27 = zext i32 %17 to i64 | ||
| %28 = add i32 %.0.sink.i, -3 | ||
| %29 = icmp ult i32 %28, 5 | ||
| %30 = zext i1 %29 to i32 | ||
| %31 = tail call ptr @LLVMConstInt(ptr noundef %21, i64 noundef %27, i32 noundef %30) #10 | ||
| %32 = tail call ptr @LLVMBuildMemCpy(ptr noundef %19, ptr noundef %12, i32 noundef %14, ptr noundef %2, i32 noundef %.0, ptr noundef %31) #10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shorter IR -> Promote inline -> Larger IR
| %.sink = phi ptr [ %8, %112 ], [ %5, %82 ] | ||
| %.pn43.pn.pn = phi ptr [ %7, %112 ], [ %4, %82 ] | ||
| %.0.sink = phi i1 [ %.0, %112 ], [ %.033, %82 ] | ||
| %.sink.ph106 = phi ptr [ %6, %112 ], [ %3, %82 ] | ||
| %.pn43.pn.pn.ph107 = phi { ptr, i32 } [ %113, %112 ], [ %83, %82 ] | ||
| %.sink104.ph = phi ptr [ %106, %112 ], [ %76, %82 ] | ||
| call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(32) %.sink109) #38 | ||
| call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(32) %.sink108) #38 | ||
| br i1 %.0.sink, label %.sink.split, label %117 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sink TWO common code but add many phis --> #IR increases.
| %.pn14.pn = phi ptr [ %4, %33 ], [ %2, %21 ] | ||
| %.sink29 = phi ptr [ %5, %33 ], [ %3, %21 ] | ||
| %.0.sink = phi i1 [ %.0, %33 ], [ %.05, %21 ] | ||
| %.pn14.pn.ph26 = phi { ptr, i32 } [ %34, %33 ], [ %22, %21 ] | ||
| %.sink.ph27 = phi ptr [ %28, %33 ], [ %16, %21 ] | ||
| call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %.sink30) #27 | ||
| call void @_ZNSaIcED1Ev(ptr noundef nonnull align 1 dereferenceable(1) %.sink29) #27 | ||
| br i1 %.0.sink, label %.sink.split, label %36 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sink 2 common IRs with adding many extra phis --> #IR increases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same. #{added phis} > #{sunk-common-IR}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same as above.
| %64 = icmp ult i32 %63, 83 | ||
| call void @llvm.lifetime.end.p0(ptr nonnull %5) | ||
| br i1 %64, label %66, label %68 | ||
| br label %68 | ||
|
|
||
| _ZN4cvc58internal5proof10DotPrinter13isTheoryLemmaEPKNS0_9ProofNodeE.exit: ; preds = %56 | ||
| %.fr = freeze i32 %61 | ||
| %65 = icmp eq i32 %.fr, 2 | ||
| call void @llvm.lifetime.end.p0(ptr nonnull %5) | ||
| br i1 %65, label %66, label %68 | ||
| br label %68 | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we sink @llvm.lifetime.end.p0 here?
|
/close |
Link: llvm/llvm-project#173353
Requested by: @Camsyn