[LLVMdev] LazyValueInfo.getPredicateAt
Philip Reames
listmail at philipreames.com
Thu Apr 16 18:46:23 PDT 2015
On 04/16/2015 10:27 AM, Hal Finkel wrote:
> ----- Original Message -----
>> From: "Artur Pilipenko" <apilipenko at azulsystems.com>
>> To: llvmdev at cs.uiuc.edu
>> Sent: Thursday, April 16, 2015 7:22:03 AM
>> Subject: [LLVMdev] LazyValueInfo.getPredicateAt
>>
>> Hi,
>>
>> Is it intentional that LazyValueInfo.getPredicateAt doesn't solve for
>> the value and only takes assumptions into account?
> Yes. That function is used from only one place in JumpThreading:
>
> } else if (CondBr && CondConst && CondBr->isConditional()) {
> // There might be an invariant in the same block with the conditional
> // that can determine the predicate.
>
> LazyValueInfo::Tristate Ret =
> LVI->getPredicateAt(CondCmp->getPredicate(), CondCmp->getOperand(0),
> CondConst, CondCmp);
> if (Ret != LazyValueInfo::Unknown) {
> ...
>
> and handles a situation that can only happen with @llvm.assume (where new information regarding a value's range is introduced in the block containing the conditional; normally this can only happen on edges and is picked up by getValueOnEdge, etc.)
Hal, independent of Artur's question, I was a bit confused by the code
you mention in your response. Reading through the code in
JumpThreading, it seems like this case could catch any case where LVI
was able to extract information about the range of a value used in a
conditional branch. Looking at the surrounding code, we even seem to be
checking for exactly that just above. Is there a reason why the edge
sensative reasoning in the previous if block shouldn't just be sunk into
LVI::getPredicateAt?
Philip
More information about the llvm-dev
mailing list