InstCombine: propagate deref via new addDereferenceableAttr
authorRamkumar Ramachandra <artagnon@gmail.com>
Sat, 14 Feb 2015 19:37:54 +0000 (19:37 +0000)
committerRamkumar Ramachandra <artagnon@gmail.com>
Sat, 14 Feb 2015 19:37:54 +0000 (19:37 +0000)
commit8fcb498a9a0825c7f6fd114f4832a5f875a05db4
treec289569a2f5dbb8d40b419d17ff422393b65de56
parent320fc2657bf4567a495e9ce02adf6de9e97721cc
InstCombine: propagate deref via new addDereferenceableAttr

The "dereferenceable" attribute cannot be added via .addAttribute(),
since it also expects a size in bytes. AttrBuilder#addAttribute or
AttributeSet#addAttribute is wrapped by classes Function, InvokeInst,
and CallInst. Add corresponding wrappers to
AttrBuilder#addDereferenceableAttr.

Having done this, propagate the dereferenceable attribute via
gc.relocate, adding a test to exercise it. Note that -datalayout is
required during execution over and above -instcombine, because
InstCombine only optionally requires DataLayoutPass.

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

llvm-svn: 229265
llvm/include/llvm/IR/Attributes.h
llvm/include/llvm/IR/Function.h
llvm/include/llvm/IR/Instructions.h
llvm/lib/IR/Attributes.cpp
llvm/lib/IR/Function.cpp
llvm/lib/IR/Instructions.cpp
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/test/Transforms/InstCombine/gc.relocate.ll [new file with mode: 0644]