summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Transforms
diff options
context:
space:
mode:
authorMarkus Lavin <markus.lavin@ericsson.com>2019-03-19 13:16:28 +0000
committerMarkus Lavin <markus.lavin@ericsson.com>2019-03-19 13:16:28 +0000
commitb86ce219f4dabe1ac5ceee79651b05308672064e (patch)
treef0d7bec6c91a9d5f21b3ae0d496c9c929eca5f41 /llvm/unittests/Transforms
parentbaa506319abdb87e759d57bd3305f13cf79fdaae (diff)
downloadbcm5719-llvm-b86ce219f4dabe1ac5ceee79651b05308672064e.tar.gz
bcm5719-llvm-b86ce219f4dabe1ac5ceee79651b05308672064e.zip
[DebugInfo] Introduce DW_OP_LLVM_convert
Introduce a DW_OP_LLVM_convert Dwarf expression pseudo op that allows for a convenient way to perform type conversions on the Dwarf expression stack. As an additional bonus it paves the way for using other Dwarf v5 ops that need to reference a base_type. The new DW_OP_LLVM_convert is used from lib/Transforms/Utils/Local.cpp to perform sext/zext on debug values but mainly the patch is about preparing terrain for adding other Dwarf v5 ops that need to reference a base_type. For Dwarf v5 the op maps to DW_OP_convert and for earlier versions a complex shift & mask pattern is generated to emulate sext/zext. This is a recommit of r356442 with trivial fixes for the failing tests. Differential Revision: https://reviews.llvm.org/D56587 llvm-svn: 356451
Diffstat (limited to 'llvm/unittests/Transforms')
-rw-r--r--llvm/unittests/Transforms/Utils/LocalTest.cpp40
1 files changed, 22 insertions, 18 deletions
diff --git a/llvm/unittests/Transforms/Utils/LocalTest.cpp b/llvm/unittests/Transforms/Utils/LocalTest.cpp
index 80f263d24a7..f83e10af756 100644
--- a/llvm/unittests/Transforms/Utils/LocalTest.cpp
+++ b/llvm/unittests/Transforms/Utils/LocalTest.cpp
@@ -788,31 +788,35 @@ TEST(Local, ReplaceAllDbgUsesWith) {
};
// Case 1: The original expr is empty, so no deref is needed.
- EXPECT_TRUE(hasADbgVal({DW_OP_dup, DW_OP_constu, 31, DW_OP_shr, DW_OP_lit0,
- DW_OP_not, DW_OP_mul, DW_OP_or, DW_OP_stack_value}));
+ EXPECT_TRUE(hasADbgVal({DW_OP_LLVM_convert, 32, DW_ATE_signed,
+ DW_OP_LLVM_convert, 64, DW_ATE_signed,
+ DW_OP_stack_value}));
// Case 2: Perform an address calculation with the original expr, deref it,
// then sign-extend the result.
- EXPECT_TRUE(hasADbgVal({DW_OP_lit0, DW_OP_mul, DW_OP_deref, DW_OP_dup,
- DW_OP_constu, 31, DW_OP_shr, DW_OP_lit0, DW_OP_not,
- DW_OP_mul, DW_OP_or, DW_OP_stack_value}));
+ EXPECT_TRUE(hasADbgVal({DW_OP_lit0, DW_OP_mul, DW_OP_deref,
+ DW_OP_LLVM_convert, 32, DW_ATE_signed,
+ DW_OP_LLVM_convert, 64, DW_ATE_signed,
+ DW_OP_stack_value}));
// Case 3: Insert the sign-extension logic before the DW_OP_stack_value.
- EXPECT_TRUE(hasADbgVal({DW_OP_lit0, DW_OP_mul, DW_OP_dup, DW_OP_constu, 31,
- DW_OP_shr, DW_OP_lit0, DW_OP_not, DW_OP_mul, DW_OP_or,
- DW_OP_stack_value}));
+ EXPECT_TRUE(hasADbgVal({DW_OP_lit0, DW_OP_mul, DW_OP_LLVM_convert, 32,
+ DW_ATE_signed, DW_OP_LLVM_convert, 64, DW_ATE_signed,
+ DW_OP_stack_value}));
// Cases 4-6: Just like cases 1-3, but preserve the fragment at the end.
- EXPECT_TRUE(hasADbgVal({DW_OP_dup, DW_OP_constu, 31, DW_OP_shr, DW_OP_lit0,
- DW_OP_not, DW_OP_mul, DW_OP_or, DW_OP_stack_value,
- DW_OP_LLVM_fragment, 0, 8}));
- EXPECT_TRUE(
- hasADbgVal({DW_OP_lit0, DW_OP_mul, DW_OP_deref, DW_OP_dup, DW_OP_constu,
- 31, DW_OP_shr, DW_OP_lit0, DW_OP_not, DW_OP_mul, DW_OP_or,
- DW_OP_stack_value, DW_OP_LLVM_fragment, 0, 8}));
- EXPECT_TRUE(hasADbgVal({DW_OP_lit0, DW_OP_mul, DW_OP_dup, DW_OP_constu, 31,
- DW_OP_shr, DW_OP_lit0, DW_OP_not, DW_OP_mul, DW_OP_or,
- DW_OP_stack_value, DW_OP_LLVM_fragment, 0, 8}));
+ EXPECT_TRUE(hasADbgVal({DW_OP_LLVM_convert, 32, DW_ATE_signed,
+ DW_OP_LLVM_convert, 64, DW_ATE_signed,
+ DW_OP_stack_value, DW_OP_LLVM_fragment, 0, 8}));
+
+ EXPECT_TRUE(hasADbgVal({DW_OP_lit0, DW_OP_mul, DW_OP_deref,
+ DW_OP_LLVM_convert, 32, DW_ATE_signed,
+ DW_OP_LLVM_convert, 64, DW_ATE_signed,
+ DW_OP_stack_value, DW_OP_LLVM_fragment, 0, 8}));
+
+ EXPECT_TRUE(hasADbgVal({DW_OP_lit0, DW_OP_mul, DW_OP_LLVM_convert, 32,
+ DW_ATE_signed, DW_OP_LLVM_convert, 64, DW_ATE_signed,
+ DW_OP_stack_value, DW_OP_LLVM_fragment, 0, 8}));
verifyModule(*M, &errs(), &BrokenDebugInfo);
ASSERT_FALSE(BrokenDebugInfo);
OpenPOWER on IntegriCloud