[PATCH] [DependenceAnalysis] Fix for PR21585: collectUpperBound triggers asserts

Brendon Cahoon bcahoon at codeaurora.org
Wed May 6 11:33:42 PDT 2015


LGTM. Btw, here's another test case that exposes the bug, and is fixed by this patch.

  ; RUN:  opt < %s -analyze -basicaa -da > /dev/null
  
  ; Test for a bug, which caused an assert in ScalarEvolution because
  ; the Dependence Analyzer attempted to zero extend a type to a smaller
  ; type.
  
  ; void t(unsigned int *a, unsigned int n) {
  ;   for (unsigned int i = 0; i != n; i++) {
  ;     a[(unsigned short)i] = g;
  ;  }}
  
  @g = common global i32 0, align 4
  
  define void @t(i32* %a, i32 %n) nounwind {
  entry:
    %cmp1 = icmp eq i32 %n, 0
    br i1 %cmp1, label %for.end, label %for.body
  
  for.body:
    %i.02 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
    %0 = load i32, i32* @g, align 4
    %idxprom = and i32 %i.02, 65535
    %arrayidx = getelementptr inbounds i32, i32* %a, i32 %idxprom
    store i32 %0, i32* %arrayidx, align 4
    %inc = add i32 %i.02, 1
    %cmp = icmp eq i32 %inc, %n
    br i1 %cmp, label %for.end, label %for.body
  
  for.end:
    ret void
  }


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D9455

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list