Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
llvm-epi-0.8
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor 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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Roger Ferrer
llvm-epi-0.8
Commits
ff510a58
Commit
ff510a58
authored
18 years ago
by
Evan Cheng
Browse files
Options
Downloads
Patches
Plain Diff
Revert previous patch. Still breaking things.
llvm-svn: 30698
parent
984f0ce0
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/IPO/ArgumentPromotion.cpp
+1
-49
1 addition, 49 deletions
llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
with
1 addition
and
49 deletions
llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
+
1
−
49
View file @
ff510a58
...
@@ -179,53 +179,6 @@ static bool AllCalleesPassInValidPointerForArgument(Argument *Arg) {
...
@@ -179,53 +179,6 @@ static bool AllCalleesPassInValidPointerForArgument(Argument *Arg) {
return
true
;
return
true
;
}
}
/// AccessOccursOnPath - Returns true if and only if a load or GEP instruction
/// on Pointer occurs in Path, or in every control-flow path that succeeds it.
bool
AccessOccursOnPath
(
Value
*
V
,
BasicBlock
*
Start
)
{
std
::
vector
<
BasicBlock
*>
Worklist
;
Worklist
.
push_back
(
Start
);
std
::
set
<
BasicBlock
*>
Visited
;
while
(
!
Worklist
.
empty
())
{
BasicBlock
*
BB
=
Worklist
.
back
();
Worklist
.
pop_back
();
Visited
.
insert
(
BB
);
bool
ContainsAccess
=
false
;
for
(
BasicBlock
::
iterator
I
=
BB
->
begin
(),
E
=
BB
->
end
();
I
!=
E
;
++
I
)
{
if
(
isa
<
LoadInst
>
(
I
))
{
for
(
Instruction
::
op_iterator
OI
=
I
->
op_begin
(),
OE
=
I
->
op_end
();
OI
!=
OE
;
++
OI
)
if
(
*
OI
==
V
)
{
ContainsAccess
=
true
;
break
;
}
}
else
if
(
isa
<
GetElementPtrInst
>
(
I
))
{
for
(
Instruction
::
op_iterator
OI
=
I
->
op_begin
(),
OE
=
I
->
op_end
();
OI
!=
OE
;
++
OI
)
if
(
*
OI
==
V
)
{
ContainsAccess
=
AccessOccursOnPath
(
I
,
I
->
getParent
());
break
;
}
}
if
(
ContainsAccess
)
break
;
}
if
(
ContainsAccess
)
continue
;
TerminatorInst
*
TI
=
BB
->
getTerminator
();
if
(
isa
<
BranchInst
>
(
TI
)
||
isa
<
SwitchInst
>
(
TI
))
{
for
(
unsigned
i
=
0
;
i
<
TI
->
getNumSuccessors
();
++
i
)
if
(
!
Visited
.
count
(
TI
->
getSuccessor
(
i
)))
Worklist
.
push_back
(
TI
->
getSuccessor
(
i
));
}
else
{
return
false
;
}
}
return
true
;
}
/// isSafeToPromoteArgument - As you might guess from the name of this method,
/// isSafeToPromoteArgument - As you might guess from the name of this method,
/// it checks to see if it is both safe and useful to promote the argument.
/// it checks to see if it is both safe and useful to promote the argument.
...
@@ -299,8 +252,7 @@ bool ArgPromotion::isSafeToPromoteArgument(Argument *Arg) const {
...
@@ -299,8 +252,7 @@ bool ArgPromotion::isSafeToPromoteArgument(Argument *Arg) const {
// of the pointer in the entry block of the function) or if we can prove that
// of the pointer in the entry block of the function) or if we can prove that
// all pointers passed in are always to legal locations (for example, no null
// all pointers passed in are always to legal locations (for example, no null
// pointers are passed in, no pointers to free'd memory, etc).
// pointers are passed in, no pointers to free'd memory, etc).
if
(
!
AccessOccursOnPath
(
Arg
,
Arg
->
getParent
()
->
begin
())
&&
if
(
!
HasLoadInEntryBlock
&&
!
AllCalleesPassInValidPointerForArgument
(
Arg
))
!
AllCalleesPassInValidPointerForArgument
(
Arg
))
return
false
;
// Cannot prove that this is safe!!
return
false
;
// Cannot prove that this is safe!!
// Okay, now we know that the argument is only used by load instructions and
// Okay, now we know that the argument is only used by load instructions and
...
...
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