[llvm-commits] [PATCH] - endless loop in instcombine and a small constant folding optimization on vectors

Nick Lewycky nicholas at mxc.ca
Mon Apr 11 23:23:49 PDT 2011


Rotem, Nadav wrote:
> Hi,
>
> Please review the attached patch:
>
> 1. Fix an endless loop in instcombine. VisitAnd changes the instruction, and VisitXor fixes it in an endless loop.

Hrmm. Neither visitAnd nor visitXor should be swapping operands for 
funsies, there should be one canonical form of the expression and 
instcombine should produce it.

I tried to analyze this, but I found that in your testcase, my 
breakpoint in visitXor never fired, there was only a look on visitAnd...

> 2. A small constant folding patch vector select with a splat condition.

+  // Handles cases where the condition is splat vector.
+  // select <false, false, ..>, X, Y -> Y
+  // select <true, true, ..>, X, Y -> X
+  if (isa<ConstantAggregateZero>(CondVal)) return FalseVal;
+  if (ConstantVector *CP = dyn_cast<ConstantVector>(CondVal)) {
+    if (CP->isAllOnesValue()) return TrueVal;

if (CP->isNullValue()) return FalseVal;  ?

Nick

+  }
+


> Thanks,
> Nadav
> ---------------------------------------------------------------------
> Intel Israel (74) Limited
>
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list