[llvm] Introduce DIExpression::foldConstantMath() (PR #71718)
Paul T Robinson via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 11 09:13:59 PDT 2024
================
@@ -3120,6 +3120,285 @@ TEST_F(DIExpressionTest, get) {
EXPECT_EQ(N0WithPrependedOps, N2);
}
+TEST_F(DIExpressionTest, Fold) {
+
+ // Remove a No-op DW_OP_plus_uconst from an expression.
+ SmallVector<uint64_t, 8> Ops = {dwarf::DW_OP_plus_uconst, 0};
+ auto *Expr = DIExpression::get(Context, Ops);
+ auto *E = Expr->foldConstantMath();
+ SmallVector<uint64_t, 8> ResOps;
+ auto *ResExpr = DIExpression::get(Context, ResOps);
----------------
pogo59 wrote:
Maybe `EmptyExpr` which you can set up once and not have to keep calling `DIExpression::get` ?
https://github.com/llvm/llvm-project/pull/71718
More information about the llvm-commits
mailing list