[PATCH] D16143: Don't propagate dereferenceable attribute through gc.relocate in InstCombine

Artur Pilipenko via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 13 06:25:10 PST 2016


apilipenko created this revision.
apilipenko added reviewers: hfinkel, reames, sanjoy.
apilipenko added a subscriber: llvm-commits.
Herald added a subscriber: sanjoy.

There is no need to propagate dereferenceable attribute through gc.relocate because isDereferenceableAndAligned pointer looks through relocations.

http://reviews.llvm.org/D16143

Files:
  lib/Transforms/InstCombine/InstCombineCalls.cpp
  test/Transforms/InstCombine/gc.relocate.ll

Index: test/Transforms/InstCombine/gc.relocate.ll
===================================================================
--- test/Transforms/InstCombine/gc.relocate.ll
+++ test/Transforms/InstCombine/gc.relocate.ll
@@ -9,17 +9,6 @@
 declare token @llvm.experimental.gc.statepoint.p0f_i1f(i64, i32, i1 ()*, i32, i32, ...)
 declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token, i32, i32)
 
-define i32 addrspace(1)* @deref(i32 addrspace(1)* dereferenceable(8) %dparam) gc "statepoint-example" {
-; Checks that a dereferenceabler pointer
-; CHECK-LABEL: @deref
-; CHECK: call dereferenceable(8)
-entry:
-    %load = load i32, i32 addrspace(1)* %dparam
-    %tok = tail call token (i64, i32, i1 ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_i1f(i64 0, i32 0, i1 ()* @return_i1, i32 0, i32 0, i32 0, i32 0, i32 addrspace(1)* %dparam)
-    %relocate = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %tok,  i32 7, i32 7)
-    ret i32 addrspace(1)* %relocate
-}
-
 define i32 @explicit_nonnull(i32 addrspace(1)* nonnull %dparam) gc "statepoint-example" {
 ; Checks that a nonnull pointer
 ; CHECK-LABEL: @explicit_nonnull
Index: lib/Transforms/InstCombine/InstCombineCalls.cpp
===================================================================
--- lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -1776,14 +1776,6 @@
     if (isKnownNonNullAt(DerivedPtr, II, DT, TLI))
       II->addAttribute(AttributeSet::ReturnIndex, Attribute::NonNull);
 
-    // isDereferenceablePointer -> deref attribute
-    if (isDereferenceablePointer(DerivedPtr, DL)) {
-      if (Argument *A = dyn_cast<Argument>(DerivedPtr)) {
-        uint64_t Bytes = A->getDereferenceableBytes();
-        II->addDereferenceableAttr(AttributeSet::ReturnIndex, Bytes);
-      }
-    }
-
     // TODO: bitcast(relocate(p)) -> relocate(bitcast(p))
     // Canonicalize on the type from the uses to the defs
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16143.44747.patch
Type: text/x-patch
Size: 1962 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160113/4bb6eba5/attachment.bin>


More information about the llvm-commits mailing list