Skip to content
  • Chris Lattner's avatar
    Enhance MemDep: When alias analysis returns a partial alias result, · 6f83d06f
    Chris Lattner authored
    return it as a clobber.  This allows GVN to do smart things.
    
    Enhance GVN to be smart about the case when a small load is clobbered
    by a larger overlapping load.  In this case, forward the value.  This
    allows us to compile stuff like this:
    
    int test(void *P) {
      int tmp = *(unsigned int*)P;
      return tmp+*((unsigned char*)P+1);
    }
    
    into:
    
    _test:                                  ## @test
    	movl	(%rdi), %ecx
    	movzbl	%ch, %eax
    	addl	%ecx, %eax
    	ret
    
    which has one load.  We already handled the case where the smaller
    load was from a must-aliased base pointer.
    
    llvm-svn: 130180
    6f83d06f
Loading