[PATCH] Use invariants in LazyValueInfo

Hal Finkel hfinkel at anl.gov
Wed Jul 16 17:08:07 PDT 2014


----- Original Message -----
> From: "Philip Reames" <listmail at philipreames.com>
> To: llvm-commits at cs.uiuc.edu, "Hal Finkel" <hfinkel at anl.gov>
> Sent: Wednesday, July 16, 2014 6:54:10 PM
> Subject: Re: [PATCH] Use invariants in LazyValueInfo
> 
> Worth noting is that your "small addition to JumpThreading" is going
> to be a general maintenance burden imposed by your approach. We'll
> have to make other such "small additions" throughout the optimizer
> when recognizing control flow patterns.

Heh; I meant small in a relative sense.

> 
> We should probably think about some form of placement
> canonicalization for them to reduce this burden.

This seems like a good idea, although there are complications re: instructions that might trap/throw. I'll be sending a note to llvmdev soon, I'll mention this suggestion.

Thanks again,
Hal

> 
> Philip
> 
> 
> On 07/14/2014 11:46 PM, hfinkel at anl.gov wrote:
> 
> 
> Hi chandlerc,
> 
> This patch teaches LazyValueInfo to use the invariant intrinsic. Like
> with the known-bits patch, this requires feeding a "context"
> instruction pointer through many functions. Aside from a little
> refactoring to reuse the logic that turns predicates into constant
> ranges in LVI, the only new code is that which can 'merge' the range
> from an invariant into that otherwise computed. There is also a
> small addition to JumpThreading so that it can have LVI use
> invariants in the same block as the comparison feeding a conditional
> branch.
> 
> With this patch, we can now simplify this as expected:
> int foo(int a) {
>   __builtin_assume(a > 5);
>   if (a > 3) {
>     bar();
>     return 1;
>   }
>   return 0;
> } http://reviews.llvm.org/D4511 Files:
>   include/llvm/Analysis/LazyValueInfo.h
>   lib/Analysis/LazyValueInfo.cpp
>   lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
>   lib/Transforms/Scalar/JumpThreading.cpp
>   test/Transforms/JumpThreading/invariants.ll
> 
> _______________________________________________
> llvm-commits mailing list llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory



More information about the llvm-commits mailing list