This is an archive of the discontinued LLVM Phabricator instance.

Don't reorder multiplies in extractConstantFactor
ClosedPublic

Authored by efriedma on Aug 16 2016, 4:58 PM.

Details

Summary

The existing code would add the operands in the wrong order, and eventually crash because the SCEV expression doesn't exactly match the parameter SCEV expression in SCEVAffinator::visit. (SCEV doesn't sort the operands to getMulExpr in general.)

Diff Detail

Repository
rL LLVM

Event Timeline

efriedma updated this revision to Diff 68282.Aug 16 2016, 4:58 PM
efriedma retitled this revision from to Don't reorder multiplies in extractConstantFactor.
efriedma updated this object.
efriedma added reviewers: grosser, jdoerfert, zinob.
efriedma set the repository for this revision to rL LLVM.
efriedma added a subscriber: pollydev.
grosser accepted this revision.Aug 17 2016, 10:49 PM
grosser edited edge metadata.

Hi Eli,

thank you for catching this. The patch looks good, just two minor comments below.

Best,
Tobias

test/ScopInfo/scop-affine-parameter-ordering.ll
1 ↗(On Diff #68282)

You could drop -polly-code-generator=isl here. It should not affect (or be needed) for this test case.

7 ↗(On Diff #68282)

To make sure we do not loose test coverage over time, it might be good to use '-analyze' and to also check that we construct the right scop.

; CHECK: Stmt_for_body8_us_us95_i
; CHECK-NEXT: Domain :=
; CHECK-NEXT: [p_0] -> { Stmt_for_body8_us_us95_i[i0] : 0 <= i0 <= 4 };
; CHECK-NEXT: Schedule :=
; CHECK-NEXT: [p_0] -> { Stmt_for_body8_us_us95_i[i0] -> [i0] };
; CHECK-NEXT; MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT; [p_0] -> { Stmt_for_body8_us_us95_i[i0] -> MemRef_0[1 + p_0] };
; CHECK-NEXT }

This revision is now accepted and ready to land.Aug 17 2016, 10:49 PM
This revision was automatically updated to reflect the committed changes.