]> granicus.if.org Git - llvm/commit
[AlignmentFromAssumptions] Don't divide by zero for unknown starting alignment
authorHal Finkel <hfinkel@anl.gov>
Wed, 10 Sep 2014 21:05:52 +0000 (21:05 +0000)
committerHal Finkel <hfinkel@anl.gov>
Wed, 10 Sep 2014 21:05:52 +0000 (21:05 +0000)
commitfb42ed29256c51852f80cebb0af2f86dba34e814
tree27293fd8abb45d972e8c575baa68f29fcc2b0768
parentec407162c137c2f446520d81795987bf23f8accc
[AlignmentFromAssumptions] Don't divide by zero for unknown starting alignment

The routine that determines an alignment given some SCEV returns zero if the
answer is unknown. In a case where we could determine the increment of an
AddRec but not the starting alignment, we would compute the integer modulus by
zero (which is illegal and traps). Prevent this by returning early if either
the start or increment alignment is unknown (zero).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217544 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/AlignmentFromAssumptions.cpp
test/Transforms/AlignmentFromAssumptions/start-unk.ll [new file with mode: 0644]