Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[clang][bytecode] Use field descriptor in IntPointer::atOffset #109238

Merged
merged 1 commit into from
Sep 19, 2024

Conversation

tbaederr
Copy link
Contributor

We're otherwise still pointing to the old type, but with the new offset.

We're otherwise still pointing to the old type, but with the new
offset.
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Sep 19, 2024
@llvmbot
Copy link
Member

llvmbot commented Sep 19, 2024

@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)

Changes

We're otherwise still pointing to the old type, but with the new offset.


Full diff: https://github.com/llvm/llvm-project/pull/109238.diff

2 Files Affected:

  • (modified) clang/lib/AST/ByteCode/Pointer.cpp (+1-1)
  • (modified) clang/test/AST/ByteCode/codegen.c (+7)
diff --git a/clang/lib/AST/ByteCode/Pointer.cpp b/clang/lib/AST/ByteCode/Pointer.cpp
index 282953eb991a6b..387cad9b137c02 100644
--- a/clang/lib/AST/ByteCode/Pointer.cpp
+++ b/clang/lib/AST/ByteCode/Pointer.cpp
@@ -665,7 +665,7 @@ IntPointer IntPointer::atOffset(const ASTContext &ASTCtx,
   uint64_t FieldOffset =
       ASTCtx.toCharUnitsFromBits(Layout.getFieldOffset(FieldIndex))
           .getQuantity();
-  return IntPointer{this->Desc, this->Value + FieldOffset};
+  return IntPointer{F->Desc, this->Value + FieldOffset};
 }
 
 IntPointer IntPointer::baseCast(const ASTContext &ASTCtx,
diff --git a/clang/test/AST/ByteCode/codegen.c b/clang/test/AST/ByteCode/codegen.c
index 8434992823010e..3c6f17e2b87264 100644
--- a/clang/test/AST/ByteCode/codegen.c
+++ b/clang/test/AST/ByteCode/codegen.c
@@ -17,3 +17,10 @@ struct B {
 };
 const int A = (char *)(&( (struct B *)(16) )->b[0]) - (char *)(16);
 // CHECK: @A = constant i32 1
+
+struct X { int a[2]; };
+int test(void) {
+  static int i23 = (int) &(((struct X *)0)->a[1]);
+  return i23;
+}
+// CHECK: @test.i23 = internal global i32 4, align 4

@tbaederr tbaederr merged commit 904f58e into llvm:main Sep 19, 2024
11 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Sep 19, 2024

LLVM Buildbot has detected a new failure on builder sanitizer-x86_64-linux-fast running on sanitizer-buildbot3 while building clang at step 2 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/169/builds/3389

Here is the relevant piece of the build log for the reference
Step 2 (annotate) failure: 'python ../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py' (failure)
...
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using lld-link: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld.lld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/ld.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using lld-link: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 85712 of 85713 tests, 88 workers --
Testing:  0.. 10
FAIL: LLVM :: CodeGen/AMDGPU/load-constant-i1.ll (594 of 85712)
******************** TEST 'LLVM :: CodeGen/AMDGPU/load-constant-i1.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 2: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llc -mtriple=amdgcn-- -verify-machineinstrs < /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/CodeGen/AMDGPU/load-constant-i1.ll | /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/FileCheck -check-prefix=GFX6 /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/CodeGen/AMDGPU/load-constant-i1.ll
+ /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llc -mtriple=amdgcn-- -verify-machineinstrs
+ /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/FileCheck -check-prefix=GFX6 /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/CodeGen/AMDGPU/load-constant-i1.ll
RUN: at line 3: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llc -mtriple=amdgcn-- -mcpu=tonga -verify-machineinstrs < /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/CodeGen/AMDGPU/load-constant-i1.ll | /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/FileCheck -check-prefix=GFX8 /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/CodeGen/AMDGPU/load-constant-i1.ll
+ /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llc -mtriple=amdgcn-- -mcpu=tonga -verify-machineinstrs
+ /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/FileCheck -check-prefix=GFX8 /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/CodeGen/AMDGPU/load-constant-i1.ll
/home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/CodeGen/AMDGPU/load-constant-i1.ll:8972:14: error: GFX8-NEXT: is not on the line after the previous match
; GFX8-NEXT: s_waitcnt vmcnt(0)
             ^
<stdin>:4279:2: note: 'next' match was here
 s_waitcnt vmcnt(0)
 ^
<stdin>:4228:64: note: previous match ended here
 buffer_store_dword v12, off, s[88:91], 0 ; 4-byte Folded Spill
                                                               ^
<stdin>:4229:1: note: non-matching line after previous match is here
 buffer_store_dword v13, off, s[88:91], 0 offset:4 ; 4-byte Folded Spill
^

Input file: <stdin>
Check file: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/CodeGen/AMDGPU/load-constant-i1.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
           .
           .
           .
        4274:  v_mov_b32_e32 v2, s10 
        4275:  v_mov_b32_e32 v3, s11 
        4276:  v_mov_b32_e32 v9, s13 
        4277:  v_mov_b32_e32 v10, s14 
Step 9 (stage2/asan_ubsan check) failure: stage2/asan_ubsan check (failure)
...
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using lld-link: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld.lld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/ld.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using lld-link: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 85712 of 85713 tests, 88 workers --
Testing:  0.. 10
FAIL: LLVM :: CodeGen/AMDGPU/load-constant-i1.ll (594 of 85712)
******************** TEST 'LLVM :: CodeGen/AMDGPU/load-constant-i1.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 2: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llc -mtriple=amdgcn-- -verify-machineinstrs < /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/CodeGen/AMDGPU/load-constant-i1.ll | /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/FileCheck -check-prefix=GFX6 /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/CodeGen/AMDGPU/load-constant-i1.ll
+ /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llc -mtriple=amdgcn-- -verify-machineinstrs
+ /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/FileCheck -check-prefix=GFX6 /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/CodeGen/AMDGPU/load-constant-i1.ll
RUN: at line 3: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llc -mtriple=amdgcn-- -mcpu=tonga -verify-machineinstrs < /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/CodeGen/AMDGPU/load-constant-i1.ll | /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/FileCheck -check-prefix=GFX8 /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/CodeGen/AMDGPU/load-constant-i1.ll
+ /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llc -mtriple=amdgcn-- -mcpu=tonga -verify-machineinstrs
+ /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/FileCheck -check-prefix=GFX8 /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/CodeGen/AMDGPU/load-constant-i1.ll
/home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/CodeGen/AMDGPU/load-constant-i1.ll:8972:14: error: GFX8-NEXT: is not on the line after the previous match
; GFX8-NEXT: s_waitcnt vmcnt(0)
             ^
<stdin>:4279:2: note: 'next' match was here
 s_waitcnt vmcnt(0)
 ^
<stdin>:4228:64: note: previous match ended here
 buffer_store_dword v12, off, s[88:91], 0 ; 4-byte Folded Spill
                                                               ^
<stdin>:4229:1: note: non-matching line after previous match is here
 buffer_store_dword v13, off, s[88:91], 0 offset:4 ; 4-byte Folded Spill
^

Input file: <stdin>
Check file: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/CodeGen/AMDGPU/load-constant-i1.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
           .
           .
           .
        4274:  v_mov_b32_e32 v2, s10 
        4275:  v_mov_b32_e32 v3, s11 
        4276:  v_mov_b32_e32 v9, s13 
        4277:  v_mov_b32_e32 v10, s14 
Step 12 (stage2/msan check) failure: stage2/msan check (failure)
...
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using lld-link: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld.lld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/ld.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using lld-link: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 85711 tests, 88 workers --
Testing:  0.. 10
FAIL: LLVM :: CodeGen/AMDGPU/load-constant-i1.ll (269 of 85711)
******************** TEST 'LLVM :: CodeGen/AMDGPU/load-constant-i1.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 2: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/llc -mtriple=amdgcn-- -verify-machineinstrs < /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/CodeGen/AMDGPU/load-constant-i1.ll | /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/FileCheck -check-prefix=GFX6 /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/CodeGen/AMDGPU/load-constant-i1.ll
+ /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/FileCheck -check-prefix=GFX6 /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/CodeGen/AMDGPU/load-constant-i1.ll
+ /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/llc -mtriple=amdgcn-- -verify-machineinstrs
RUN: at line 3: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/llc -mtriple=amdgcn-- -mcpu=tonga -verify-machineinstrs < /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/CodeGen/AMDGPU/load-constant-i1.ll | /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/FileCheck -check-prefix=GFX8 /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/CodeGen/AMDGPU/load-constant-i1.ll
+ /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/FileCheck -check-prefix=GFX8 /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/CodeGen/AMDGPU/load-constant-i1.ll
+ /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/llc -mtriple=amdgcn-- -mcpu=tonga -verify-machineinstrs
/home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/CodeGen/AMDGPU/load-constant-i1.ll:8972:14: error: GFX8-NEXT: is not on the line after the previous match
; GFX8-NEXT: s_waitcnt vmcnt(0)
             ^
<stdin>:4279:2: note: 'next' match was here
 s_waitcnt vmcnt(0)
 ^
<stdin>:4228:64: note: previous match ended here
 buffer_store_dword v12, off, s[88:91], 0 ; 4-byte Folded Spill
                                                               ^
<stdin>:4229:1: note: non-matching line after previous match is here
 buffer_store_dword v13, off, s[88:91], 0 offset:4 ; 4-byte Folded Spill
^

Input file: <stdin>
Check file: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/CodeGen/AMDGPU/load-constant-i1.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
           .
           .
           .
        4274:  v_mov_b32_e32 v2, s10 
        4275:  v_mov_b32_e32 v3, s11 
        4276:  v_mov_b32_e32 v9, s13 
        4277:  v_mov_b32_e32 v10, s14 

tmsri pushed a commit to tmsri/llvm-project that referenced this pull request Sep 19, 2024
…109238)

We're otherwise still pointing to the old type, but with the new offset.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants