[clang] [clang][bytecode][NFC] Use Pointer::pointToSameBlock (PR #119552)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 11 04:53:07 PST 2024


https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/119552

block() requires the pointer to be a block pointer.

>From 254b9ed55904777931f666a30110fd356c595243 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Wed, 11 Dec 2024 13:52:02 +0100
Subject: [PATCH] [clang][bytecode][NFC] Use Pointer::pointToSameBlock

block() requires the pointer to be a block pointer.
---
 clang/lib/AST/ByteCode/InterpBuiltin.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
index 4fe17ec01906e9..57175da32b31cd 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -1876,7 +1876,7 @@ static bool interp__builtin_memcpy(InterpState &S, CodePtr OpPC,
   }
 
   // Check for overlapping memory regions.
-  if (!Move && SrcPtr.block() == DestPtr.block()) {
+  if (!Move && Pointer::pointToSameBlock(SrcPtr, DestPtr)) {
     unsigned SrcIndex = SrcPtr.getIndex() * SrcPtr.elemSize();
     unsigned DstIndex = DestPtr.getIndex() * DestPtr.elemSize();
     unsigned N = Size.getZExtValue();



More information about the cfe-commits mailing list