loop metdata instruction

Hi

I’m working on a project which needs loop-attached metadata similar to
the parallel metadata discussed in here. Currently I’m trying to make
the metadata get through the optimisation passes unscathed. For loop
passes, I’ve solved that by modifying the LPPassManager to check for
metadata presence before and after runOnLoop, and restoring it if
necessary (assuming the loop didn’t get removed and the metadata
didn’t get moved).

However, the CFG simplifier pass also can optimize the loop latch and
attached metadata away. As this is a function pass, I don’t have
access to the loop-specific functionality such as getLoopLatch to
check for metadata.

Any suggestions how to fix this? How would the parallel loop metadata
discussed in here survive these CFG simplifications?

Michael

Hi

I’m working on a project which needs loop-attached metadata similar to
the parallel metadata discussed in here. Currently I’m trying to make
the metadata get through the optimisation passes unscathed. For loop
passes, I’ve solved that by modifying the LPPassManager to check for
metadata presence before and after runOnLoop, and restoring it if
necessary (assuming the loop didn’t get removed and the metadata
didn’t get moved).

However, the CFG simplifier pass also can optimize the loop latch and
attached metadata away. As this is a function pass, I don’t have
access to the loop-specific functionality such as getLoopLatch to
check for metadata.

Any suggestions how to fix this? How would the parallel loop metadata
discussed in here survive these CFG simplifications?

Michael

From: "Michael D'hont" <micdhont@gmail.com>
To: llvmdev@cs.uiuc.edu
Sent: Sunday, March 3, 2013 7:15:33 AM
Subject: [LLVMdev] loop metdata instruction

Hi

I'm working on a project which needs loop-attached metadata similar
to
the parallel metadata discussed in here. Currently I'm trying to make
the metadata get through the optimisation passes unscathed. For loop
passes, I've solved that by modifying the LPPassManager to check for
metadata presence before and after runOnLoop, and restoring it if
necessary (assuming the loop didn't get removed and the metadata
didn't get moved).

Can you be more specific about how you're doing this?

However, the CFG simplifier pass also can optimize the loop latch and
attached metadata away. As this is a function pass, I don't have
access to the loop-specific functionality such as getLoopLatch to
check for metadata.

Why can't a function pass have access to loop-level information? I think that a function level pass can require LoopInfo, and then call:
LoopInfo *LI = &getAnalysis<LoopInfo>();
(and then you can use LI->getLoopFor, etc.)

In any case, why can't you just check for the metadata on any branch being modified?

Thanks again,
Hal