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
e5f15cdc
Commit
e5f15cdc
authored
21 years ago
by
Chris Lattner
Browse files
Options
Downloads
Patches
Plain Diff
Fix bug: ConstantMerge/2003-10-28-MergeExternalConstants.ll & PR64
llvm-svn: 9579
parent
fa979bd7
No related branches found
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/ConstantMerge.cpp
+13
-2
13 additions, 2 deletions
llvm/lib/Transforms/IPO/ConstantMerge.cpp
with
13 additions
and
2 deletions
llvm/lib/Transforms/IPO/ConstantMerge.cpp
+
13
−
2
View file @
e5f15cdc
...
@@ -52,14 +52,25 @@ bool ConstantMerge::run(Module &M) {
...
@@ -52,14 +52,25 @@ bool ConstantMerge::run(Module &M) {
if
(
I
==
CMap
.
end
())
{
// Nope, add it to the map
if
(
I
==
CMap
.
end
())
{
// Nope, add it to the map
CMap
.
insert
(
I
,
std
::
make_pair
(
Init
,
GV
));
CMap
.
insert
(
I
,
std
::
make_pair
(
Init
,
GV
));
}
else
{
// Yup, this is a duplicate!
}
else
if
(
GV
->
hasInternalLinkage
())
{
// Yup, this is a duplicate!
// Make all uses of the duplicate constant use the canonical version...
// Make all uses of the duplicate constant use the canonical version...
GV
->
replaceAllUsesWith
(
I
->
second
);
GV
->
replaceAllUsesWith
(
I
->
second
);
// Delete the global value from the module... and back up iterator to
// Delete the global value from the module... and back up iterator to
// not skip the next global...
// not skip the next global...
GV
=
--
M
.
getGlobalList
().
erase
(
GV
);
GV
=
--
M
.
getGlobalList
().
erase
(
GV
);
++
NumMerged
;
MadeChanges
=
true
;
}
else
if
(
I
->
second
->
hasInternalLinkage
())
{
// Make all uses of the duplicate constant use the canonical version...
I
->
second
->
replaceAllUsesWith
(
GV
);
// Delete the global value from the module... and back up iterator to
// not skip the next global...
M
.
getGlobalList
().
erase
(
I
->
second
);
I
->
second
=
GV
;
++
NumMerged
;
++
NumMerged
;
MadeChanges
=
true
;
MadeChanges
=
true
;
}
}
...
...
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