OSDN Git Service

Fix ScalarEvolutionExpander step scaling bug
authorKeno Fischer <kfischer@college.harvard.edu>
Wed, 13 Jul 2016 01:28:12 +0000 (01:28 +0000)
committerKeno Fischer <kfischer@college.harvard.edu>
Wed, 13 Jul 2016 01:28:12 +0000 (01:28 +0000)
commitc8ce9e59a883f452bc538b5f16fb83649472dc3e
tree51ba6734af552f63d86dfde18355cb8312a57254
parentf0bd87ec4e68e7abd5f34becce3131af8c6a094a
Fix ScalarEvolutionExpander step scaling bug

The expandAddRecExprLiterally function incorrectly transforms
`[Start + Step * X]` into `Step * [Start + X]` instead of the correct
transform of `[Step * X] + Start`.

This caused https://github.com/JuliaLang/julia/issues/14704#issuecomment-174126219
due to what appeared to be sufficiently complicated loop interactions.

Patch by Jameson Nash (jameson@juliacomputing.com).

Reviewers: sanjoy
Differential Revision: http://reviews.llvm.org/D16505

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275239 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ScalarEvolutionExpander.cpp
test/Analysis/ScalarEvolution/incorrect-offset-scaling.ll [new file with mode: 0644]