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)
commit0608cec6578af02c49ddf5d47baecffde1404ccd
tree0ccbf66c7e5077d14105a0b0f3f2dc30ca3b89ca
parentc7fe1ab2504692c99bc7625e2e1821debe3c8c3e
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229265 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/Attributes.h
include/llvm/IR/Function.h
include/llvm/IR/Instructions.h
lib/IR/Attributes.cpp
lib/IR/Function.cpp
lib/IR/Instructions.cpp
lib/Transforms/InstCombine/InstCombineCalls.cpp
test/Transforms/InstCombine/gc.relocate.ll [new file with mode: 0644]