-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[Mips] Add the missing judgment when processing function handleMFLOSlot #121463
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
Conversation
@wzssyqa could you help review, thanks! |
Ping |
I think that we need a testcase for it. |
@@ -751,9 +751,8 @@ bool MipsBranchExpansion::handleMFLOSlot(Pred Predicate, Safe SafeInSlot) { | |||
for (MachineFunction::iterator FI = MFp->begin(); FI != MFp->end(); ++FI) { | |||
for (Iter I = FI->begin(); I != FI->end(); ++I) { | |||
|
|||
if (!Predicate(*I) && !hasPendingMFLO) { | |||
if (!Predicate(*I) && !hasPendingMFLO) |
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.
This change seems not needed.
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.
OK, applied.
I guess that there may be some other problem: why this patch can effects MIPSr2? |
We have already made a restriction at the beginning.
|
In file "clang/lib/Driver/ToolChains/Arch/Mips.cpp", have the following define.
|
c078903
to
6de9fc2
Compare
OK, added. Please help review again, thanks! |
✅ With the latest revision this PR passed the undef deprecator. |
@@ -0,0 +1,67 @@ | |||
; RUN: llc -filetype=asm < %s -mcpu=mips2 | FileCheck %s -check-prefixes=MIPS2 | |||
; |
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.
We should keep the IR file simple.
we can use
RUN: llc -filetype=asm --mtriple=mips -mcpu=mips2 < %s | FileCheck %s -check-prefixes=MIPS2
So that we won't need
target datalayout = "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"
target triple = "mips-unknown-freebsd"
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.
OK, applied.
; } | ||
|
||
target datalayout = "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64" | ||
target triple = "mips-unknown-freebsd" |
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.
We can remove these 2 lines.
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.
OK, applied.
@l2arc_feed_secs = local_unnamed_addr global i32 0, align 4 | ||
@l2arc_write_interval_next = local_unnamed_addr global i32 0, align 4 | ||
|
||
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) |
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.
This line can be removed.
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.
OK, applied.
store i32 %interval.0, ptr @l2arc_write_interval_next, align 4, !tbaa !2 | ||
ret void | ||
} | ||
|
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 following lines can be removed.
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.
OK, because I refer to some other test files that generate .ll from .c, which are all included, I will delete them later.
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.
OK, applied.
; MIPS2-NEXT: j $BB0_3 | ||
; MIPS2-NEXT: nop | ||
entry: | ||
%0 = load i32, ptr @l2arc_write_interval_wrote, align 4, !tbaa !2 |
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.
We can remove all , !tbaa !2
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.
OK, applied.
br label %if.end | ||
|
||
if.end: ; preds = %if.then, %entry | ||
%interval.0 = phi i32 [ %div, %if.then ], [ undef, %entry ] |
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.
Use poison
instead of undef
.
; clang -cc1 -triple mips-unknown-freebsd -target-cpu mips2 -O2 -emit-llvm test.c -o test.ll | ||
; int l2arc_feed_secs, l2arc_feed_min_ms, l2arc_write_interval_wrote, l2arc_write_interval_next; | ||
; void l2arc_write_interval() { | ||
; int interval; |
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.
maybe we should use
int interval = l2arc_write_interval_next;
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.
OK, I initialized the variable interval
to 0, and it would not produce undef
.
In function handleMFLOSlot, we may get a variable LastInstInFunction with a value of true from function getNextMachineInstr and IInSlot may be null which would trigger an assert. So we need to skip this case. Fix llvm#118223.
6de9fc2
to
08a4995
Compare
In function handleMFLOSlot, we may get a variable LastInstInFunction with a value of true from function getNextMachineInstr and IInSlot may be null which would trigger an assert.
So we need to skip this case.
Fix #118223.