[llvm-commits] [llvm] r42075 - in /llvm/trunk: lib/Transforms/Scalar/LICM.cpp test/Transforms/LICM/2007-09-17-PrompteValue.ll
Devang Patel
dpatel at apple.com
Tue Sep 18 10:42:54 PDT 2007
On Sep 18, 2007, at 7:02 AM, Dan Gohman wrote:
>> + // If GEP base is NULL then the calculated address used by
>> Store or
>> + // Load instruction is invalid. Do not promote this value
>> because
>> + // it may expose load and store instruction that are covered
>> by
>> + // condition which may not yet folded.
>> + if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(V))
>> + if (isa<ConstantPointerNull>(GEP->getOperand(0)))
>> + PointerOk = false;
>> +
>
> It looks like there's a larger problem here. The testcase's loop body
> may never be executed, so it isn't safe for LICM to hoist/sink
> anything out to an unguarded location, null pointer constants or
> otherwise.
We intend to split LICM into three passes - sink, hoist and promote-
values. Irrespective of sinking and hoisting, promote-values should
not promote values that are unsafe. Avoiding hoisting GEP here will
solve this test case, but promote-values bug will be exposed when it
is supplied manually hoisted GEP.
promote-values is not in business to identify dead loops. And when
loop conditionals are runtime dependent it is not possible to
determine it at compile time at all. The fix is to check unsafe stores
and loads before promoting value.
-
Devang
More information about the llvm-commits
mailing list