[PATCH] D42103: [LSR] Don't force bases of foldable formulae to the final type.

Quentin Colombet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 29 16:16:57 PST 2018


qcolombet accepted this revision.
qcolombet added a comment.
This revision is now accepted and ready to land.

Alright, LGTM then.
Please also patches the two other places I mentioned assuming you can have a test case for them.



================
Comment at: lib/Transforms/Scalar/LoopStrengthReduce.cpp:4996
           isAMCompletelyFolded(TTI, LU, F)) {
-        Value *FullV = Rewriter.expandCodeFor(SE.getAddExpr(Ops), Ty);
+        Value *FullV = Rewriter.expandCodeFor(SE.getAddExpr(Ops), nullptr);
         Ops.clear();
----------------
ebevhan wrote:
> qcolombet wrote:
> > I don't think this is what we want, FullV is supposed to have the same type as F.
> > 
> > That said, I would have expected your test case to have been recognized by the check line 4948.
> > 
> > Could you check why this is not happening?
> In the test case in this patch (and it's probably the same for the local test case I found this in originally), the check on 4948 does trigger. Ty is i64 and OpTy is i8*. Since the effective SCEV type for both of these is i64, Ty is set to i8* and the base (which is originally an integer) is converted into a pointer when it's expanded.
Thanks for double checking.


https://reviews.llvm.org/D42103





More information about the llvm-commits mailing list