r362545 - Introduce Value::stripPointerCastsSameRepresentation

Johannes Doerfert via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 4 13:21:46 PDT 2019


Author: jdoerfert
Date: Tue Jun  4 13:21:46 2019
New Revision: 362545

URL: http://llvm.org/viewvc/llvm-project?rev=362545&view=rev
Log:
Introduce Value::stripPointerCastsSameRepresentation

This patch allows current users of Value::stripPointerCasts() to force
the result of the function to have the same representation as the value
it was called on. This is useful in various cases, e.g., (non-)null
checks.

In this patch only a single call site was adjusted to fix an existing
misuse that would cause nonnull where they may be wrong. Uses in
attribute deduction and other areas, e.g., D60047, are to be expected.

For a discussion on this topic, please see [0].

[0] http://lists.llvm.org/pipermail/llvm-dev/2018-December/128423.html

Reviewers: hfinkel, arsenm, reames

Subscribers: wdng, hiraditya, bollu, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D61607

Modified:
    cfe/trunk/test/CodeGenOpenCLCXX/addrspace-references.cl

Modified: cfe/trunk/test/CodeGenOpenCLCXX/addrspace-references.cl
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCLCXX/addrspace-references.cl?rev=362545&r1=362544&r2=362545&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenOpenCLCXX/addrspace-references.cl (original)
+++ cfe/trunk/test/CodeGenOpenCLCXX/addrspace-references.cl Tue Jun  4 13:21:46 2019
@@ -9,6 +9,6 @@ void foo() {
   // CHECK: [[REF:%.*]] = alloca i32
   // CHECK: store i32 1, i32* [[REF]]
   // CHECK: [[REG:%[0-9]+]] = addrspacecast i32* [[REF]] to i32 addrspace(4)*
-  // CHECK: call spir_func i32 @_Z3barRU3AS4Kj(i32 addrspace(4)* nonnull dereferenceable(4) [[REG]])
+  // CHECK: call spir_func i32 @_Z3barRU3AS4Kj(i32 addrspace(4)* dereferenceable(4) [[REG]])
   bar(1);
 }




More information about the cfe-commits mailing list