[DependenceAnalysis] Allow subscripts of different types
authorJingyue Wu <jingyue@google.com>
Sun, 16 Nov 2014 16:52:44 +0000 (16:52 +0000)
committerJingyue Wu <jingyue@google.com>
Sun, 16 Nov 2014 16:52:44 +0000 (16:52 +0000)
commit0fa125a77d4c960837c36c30ce8cecf8262f35e9
tree5a90bc8a407513b1eff726c30773443b5c7c0e8c
parentbf34f1d2b25f1c9a5e0904bdd8145e730268a498
[DependenceAnalysis] Allow subscripts of different types

Summary:
Several places in DependenceAnalysis assumes both SCEVs in a subscript pair
share the same integer type. For instance, isKnownPredicate calls
SE->getMinusSCEV(X, Y) which asserts X and Y share the same type. However,
DependenceAnalysis fails to ensure this assumption when producing a subscript
pair, causing tests such as NonCanonicalizedSubscript to crash. With this
patch, DependenceAnalysis runs unifySubscriptType before producing any
subscript pair, ensuring the assumption.

Test Plan:
Added NonCanonicalizedSubscript.ll on which DependenceAnalysis before the fix
crashed because subscripts have different types.

Reviewers: spop, sebpop, jingyue

Reviewed By: jingyue

Subscribers: eliben, meheff, llvm-commits

Differential Revision: http://reviews.llvm.org/D6289

llvm-svn: 222100
llvm/include/llvm/Analysis/DependenceAnalysis.h
llvm/lib/Analysis/DependenceAnalysis.cpp
llvm/test/Analysis/DependenceAnalysis/NonCanonicalizedSubscript.ll [new file with mode: 0644]