Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LLVM bpEVL
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lorenzo Albano
LLVM bpEVL
Commits
b659bb41
Commit
b659bb41
authored
18 years ago
by
Owen Anderson
Browse files
Options
Downloads
Patches
Plain Diff
De-pessimize the handling of LCSSA Phi nodes in IndVarSimplify. Hopefully this
will make Shootout-C/nestedloop faster. llvm-svn: 28924
parent
1df08390
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
+29
-15
29 additions, 15 deletions
llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
with
29 additions
and
15 deletions
llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
+
29
−
15
View file @
b659bb41
...
@@ -325,20 +325,8 @@ void IndVarSimplify::RewriteLoopExitValues(Loop *L) {
...
@@ -325,20 +325,8 @@ void IndVarSimplify::RewriteLoopExitValues(Loop *L) {
for
(
Value
::
use_iterator
UI
=
I
->
use_begin
(),
E
=
I
->
use_end
();
for
(
Value
::
use_iterator
UI
=
I
->
use_begin
(),
E
=
I
->
use_end
();
UI
!=
E
;
++
UI
)
{
UI
!=
E
;
++
UI
)
{
Instruction
*
User
=
cast
<
Instruction
>
(
*
UI
);
Instruction
*
User
=
cast
<
Instruction
>
(
*
UI
);
if
(
!
L
->
contains
(
User
->
getParent
()))
{
if
(
!
L
->
contains
(
User
->
getParent
()))
// If this is a PHI node in the exit block and we're inserting,
// into the exit block, it must have a single entry. In this
// case, we can't insert the code after the PHI and have the PHI
// still use it. Instead, don't insert the the PHI.
if
(
PHINode
*
PN
=
dyn_cast
<
PHINode
>
(
User
))
{
// FIXME: This is a case where LCSSA pessimizes code, this
// should be fixed better.
if
(
PN
->
getNumOperands
()
==
2
&&
PN
->
getParent
()
==
BlockToInsertInto
)
continue
;
}
ExtraLoopUsers
.
push_back
(
User
);
ExtraLoopUsers
.
push_back
(
User
);
}
}
}
if
(
!
ExtraLoopUsers
.
empty
())
{
if
(
!
ExtraLoopUsers
.
empty
())
{
...
@@ -358,8 +346,34 @@ void IndVarSimplify::RewriteLoopExitValues(Loop *L) {
...
@@ -358,8 +346,34 @@ void IndVarSimplify::RewriteLoopExitValues(Loop *L) {
// Rewrite any users of the computed value outside of the loop
// Rewrite any users of the computed value outside of the loop
// with the newly computed value.
// with the newly computed value.
for
(
unsigned
i
=
0
,
e
=
ExtraLoopUsers
.
size
();
i
!=
e
;
++
i
)
for
(
unsigned
i
=
0
,
e
=
ExtraLoopUsers
.
size
();
i
!=
e
;
++
i
)
{
ExtraLoopUsers
[
i
]
->
replaceUsesOfWith
(
I
,
NewVal
);
PHINode
*
PN
=
dyn_cast
<
PHINode
>
(
ExtraLoopUsers
[
i
]);
if
(
PN
&&
PN
->
getParent
()
==
BlockToInsertInto
)
{
// We're dealing with an LCSSA Phi. Handle it specially.
Instruction
*
LCSSAInsertPt
=
BlockToInsertInto
->
begin
();
Instruction
*
NewInstr
=
dyn_cast
<
Instruction
>
(
NewVal
);
if
(
Instruction
*
NewInstr
=
dyn_cast
<
Instruction
>
(
NewVal
))
for
(
unsigned
j
=
0
;
j
<
NewInstr
->
getNumOperands
();
++
j
){
Instruction
*
PredI
=
dyn_cast
<
Instruction
>
(
NewInstr
->
getOperand
(
j
));
if
(
PredI
&&
L
->
contains
(
PredI
->
getParent
()))
{
PHINode
*
NewLCSSA
=
new
PHINode
(
PredI
->
getType
(),
PredI
->
getName
()
+
".lcssa"
,
LCSSAInsertPt
);
NewLCSSA
->
addIncoming
(
PredI
,
BlockToInsertInto
->
getSinglePredecessor
());
NewInstr
->
replaceUsesOfWith
(
PredI
,
NewLCSSA
);
}
}
PN
->
replaceAllUsesWith
(
NewVal
);
PN
->
eraseFromParent
();
}
else
{
ExtraLoopUsers
[
i
]
->
replaceUsesOfWith
(
I
,
NewVal
);
}
}
// If this instruction is dead now, schedule it to be removed.
// If this instruction is dead now, schedule it to be removed.
if
(
I
->
use_empty
())
if
(
I
->
use_empty
())
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment