This is an archive of the discontinued LLVM Phabricator instance.

Refactor SimplifyCFG:canSinkInstructions [NFC]
ClosedPublic

Authored by hiraditya on Feb 17 2017, 1:41 PM.

Diff Detail

Event Timeline

hiraditya created this revision.Feb 17 2017, 1:41 PM
jmolloy requested changes to this revision.Mar 1 2017, 9:10 AM

Hi,

Can you please explain what you are doing and why? Is there a functional change here? or just moving code around?

I can see a functional change

llvm/lib/Transforms/Utils/SimplifyCFG.cpp
1454

Why?

1465

This change looks fine.

1488

Your new code is ignoring the operand index, so is more conservative than the old code.

This revision now requires changes to proceed.Mar 1 2017, 9:10 AM

This patch is only to move the code around to avoid + avoid redundant computations.

llvm/lib/Transforms/Utils/SimplifyCFG.cpp
1454

I can remove this if you want.

1488

This code will only execute when IO is a store instruction. And stores have 2 operands, so that implies OI=1 is not needed when we hoist this code out of the loop. It appears OI==1 check was there because for stores second operand is the pointer operand, and for stores first operand (OI==0) is the pointer operand.

hiraditya updated this revision to Diff 90385.Mar 2 2017, 1:32 PM
hiraditya edited edge metadata.
jmolloy accepted this revision.Mar 10 2017, 1:00 AM

LGTM

This revision is now accepted and ready to land.Mar 10 2017, 1:00 AM
This revision was automatically updated to reflect the committed changes.