Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
2
2022fall-Compiler_CMinus
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李晓奇
2022fall-Compiler_CMinus
Commits
bb6e3f98
Commit
bb6e3f98
authored
Dec 09, 2022
by
李晓奇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pass all!
parent
f1600373
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
src/optimization/GVN.cpp
src/optimization/GVN.cpp
+3
-2
No files found.
src/optimization/GVN.cpp
View file @
bb6e3f98
...
@@ -985,11 +985,12 @@ GVN::pretend_copy_stmt(Instruction *instr, BasicBlock *bb) {
...
@@ -985,11 +985,12 @@ GVN::pretend_copy_stmt(Instruction *instr, BasicBlock *bb) {
auto
phi
=
static_cast
<
PhiInst
*>
(
instr
);
auto
phi
=
static_cast
<
PhiInst
*>
(
instr
);
// res = phi [op1, name1], [op2, name2]
// res = phi [op1, name1], [op2, name2]
// ^0 ^1 ^2 ^3
// ^0 ^1 ^2 ^3
if
(
phi
->
get_operand
(
1
)
->
get_name
()
==
bb
->
get_name
())
{
// if (phi->get_operand(1)->get_name() == bb->get_name()) {
if
(
static_cast
<
BasicBlock
*>
(
phi
->
get_operand
(
1
))
==
bb
)
{
// pretend copy statement:
// pretend copy statement:
// `res = op1`
// `res = op1`
return
0
;
return
0
;
}
else
if
(
phi
->
get_operand
(
3
)
->
get_name
()
==
bb
->
get_name
()
)
{
}
else
if
(
static_cast
<
BasicBlock
*>
(
phi
->
get_operand
(
3
))
==
bb
)
{
// `res = op2`
// `res = op2`
return
2
;
return
2
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment