[clang] [clang][bytecode][NFC] Remove unused opcodes (PR #218433)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 24 07:58:41 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Timm Baeder (tbaederr)
<details>
<summary>Changes</summary>
SetField and SetThisField are never emitted.
---
Full diff: https://github.com/llvm/llvm-project/pull/218433.diff
2 Files Affected:
- (modified) clang/lib/AST/ByteCode/Interp.h (-31)
- (modified) clang/lib/AST/ByteCode/Opcodes.td (-5)
``````````diff
diff --git a/clang/lib/AST/ByteCode/Interp.h b/clang/lib/AST/ByteCode/Interp.h
index cdcd0b717b779..b203e6f17e0bb 100644
--- a/clang/lib/AST/ByteCode/Interp.h
+++ b/clang/lib/AST/ByteCode/Interp.h
@@ -1715,22 +1715,6 @@ bool GetFieldPop(InterpState &S, CodePtr OpPC, uint32_t I) {
return true;
}
-template <PrimType Name, class T = typename PrimConv<Name>::T>
-bool SetField(InterpState &S, CodePtr OpPC, uint32_t I) {
- const T &Value = S.Stk.pop<T>();
- const Pointer &Obj = S.Stk.peek<Pointer>();
- if (!CheckNull(S, OpPC, Obj, CSK_Field))
- return false;
- if (!CheckRange(S, OpPC, Obj, CSK_Field))
- return false;
- const Pointer &Field = Obj.atField(I);
- if (!CheckStore(S, OpPC, Field))
- return false;
- Field.initialize();
- Field.deref<T>() = Value;
- return true;
-}
-
template <PrimType Name, class T = typename PrimConv<Name>::T>
bool GetThisField(InterpState &S, CodePtr OpPC, uint32_t I) {
if (S.checkingPotentialConstantExpression())
@@ -1745,21 +1729,6 @@ bool GetThisField(InterpState &S, CodePtr OpPC, uint32_t I) {
return true;
}
-template <PrimType Name, class T = typename PrimConv<Name>::T>
-bool SetThisField(InterpState &S, CodePtr OpPC, uint32_t I) {
- if (S.checkingPotentialConstantExpression())
- return false;
- if (!CheckThis(S, OpPC))
- return false;
- const T &Value = S.Stk.pop<T>();
- const Pointer &This = S.Current->getThis();
- const Pointer &Field = This.atField(I);
- if (!CheckStore(S, OpPC, Field))
- return false;
- Field.deref<T>() = Value;
- return true;
-}
-
template <PrimType Name, class T = typename PrimConv<Name>::T>
bool GetGlobal(InterpState &S, CodePtr OpPC, uint32_t I) {
const Block *B = S.P.getGlobal(I);
diff --git a/clang/lib/AST/ByteCode/Opcodes.td b/clang/lib/AST/ByteCode/Opcodes.td
index 74d3cc84e06ab..c9a46244bad88 100644
--- a/clang/lib/AST/ByteCode/Opcodes.td
+++ b/clang/lib/AST/ByteCode/Opcodes.td
@@ -534,11 +534,6 @@ def GetFieldPop : AccessOpcode;
// [] -> [Value]
def GetThisField : AccessOpcode;
-// [Pointer, Value] -> [Pointer]
-def SetField : AccessOpcode;
-// [Value] -> []
-def SetThisField : AccessOpcode;
-
// [Value] -> []
def InitThisField : AccessOpcode;
def InitThisFieldActivate : AccessOpcode;
``````````
</details>
https://github.com/llvm/llvm-project/pull/218433
More information about the cfe-commits
mailing list