[PATCH] WIP: AddDiscriminators: Check more carefully for equivalent locations

Diego Novillo dnovillo at google.com
Fri Apr 10 06:50:22 PDT 2015



On 04/09/15 20:26, Duncan P. N. Exon Smith wrote:

> diff --git a/lib/Transforms/Utils/AddDiscriminators.cpp 
> b/lib/Transforms/Utils/AddDiscriminators.cpp
> index 0379736..661dc5e 100644
> --- a/lib/Transforms/Utils/AddDiscriminators.cpp
> +++ b/lib/Transforms/Utils/AddDiscriminators.cpp
> @@ -189,7 +189,7 @@ bool AddDiscriminators::runOnFunction(Function &F) {
>        // location as B's last instruction (Last), add a new
>        // discriminator for First's location and all the instructions
>        // in Succ that share the same location with First.
> -      if (FirstDIL.atSameLineAs(LastDIL)) {
> +      if (FirstDIL == LastDIL) {

This will not work as expected. The comparison between the two LOCs need 
to be necessarily loose. If both LOCs are at the same line number, then 
we need discriminators to distinguish them.  E.g.,

  9 ...
10  if (x) y++; else z--;
11 ...

We need discriminators for the expressions 'if (x)', 'y++' and 'z--'. 
They all have different LOCs because they have different column numbers. 
We need to do the loose comparison 'are they on the same line?'. If so, 
then each of them gets a new discriminator.

What are you trying to fix? Not sure I understand what's failing here.


Diego.



More information about the llvm-commits mailing list