[LLVMdev] question about licm

Nema, Ashutosh Ashutosh.Nema at amd.com
Wed Feb 11 01:20:27 PST 2015


Hi,

LICM can only hoist instructions which dominates all loop exit blocks.
In this case 'upper[j]' is not dominating exit block as its appearing in second operand of logical AND operator.

Prior to hoisting it check for condition in 'isGuaranteedToExecute' and it decide not to hoist it.

<File: LICM.cpp>
666 bool LICM::isGuaranteedToExecute(Instruction &Inst) {
667
668   // We have to check to make sure that the instruction dominates all
669   // of the exit blocks.  If it doesn't, then there is a path out of the loop
670   // which does not execute this instruction, so we can't hoist it.

Hope this helps.

Regards,
Ashutosh

-----Original Message-----
From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of songlh
Sent: Wednesday, February 11, 2015 10:24 AM
To: llvmdev at cs.uiuc.edu
Subject: [LLVMdev] question about licm

hi,

   I applied licm with basicaa on the following codes:

   int j = atoi(argc[1]);
   int lower[] = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
   int upper[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};

   for(i = lower[j]; a[i] < 100 && i < upper[j]; i ++);

   I notice that upper[j] is not hoisted out from the loop. Is this because j could be larger than 10?

   Thanks a lot!

   Best,

                                              Linhai _______________________________________________
LLVM Developers mailing list
LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list