@@ -28,22 +28,6 @@ extern cl::opt<cl::boolOrDefault> PreserveInputDbgFormat;
28
28
extern bool WriteNewDbgInfoFormatToBitcode;
29
29
extern cl::opt<bool > WriteNewDbgInfoFormat;
30
30
31
- // Backup all of the existing settings that may be modified when
32
- // PreserveInputDbgFormat=true, so that when the test is finished we return them
33
- // (and the "preserve" setting) to their original values.
34
- static auto SaveDbgInfoFormat () {
35
- return make_scope_exit (
36
- [OldPreserveInputDbgFormat = PreserveInputDbgFormat.getValue (),
37
- OldUseNewDbgInfoFormat = UseNewDbgInfoFormat.getValue (),
38
- OldWriteNewDbgInfoFormatToBitcode = WriteNewDbgInfoFormatToBitcode,
39
- OldWriteNewDbgInfoFormat = WriteNewDbgInfoFormat.getValue ()] {
40
- PreserveInputDbgFormat = OldPreserveInputDbgFormat;
41
- UseNewDbgInfoFormat = OldUseNewDbgInfoFormat;
42
- WriteNewDbgInfoFormatToBitcode = OldWriteNewDbgInfoFormatToBitcode;
43
- WriteNewDbgInfoFormat = OldWriteNewDbgInfoFormat;
44
- });
45
- }
46
-
47
31
static std::unique_ptr<Module> makeLLVMModule (LLVMContext &Context,
48
32
StringRef ModuleStr) {
49
33
SMDiagnostic Err;
@@ -1328,25 +1312,19 @@ TEST(IRInstructionMapper, CallBrInstIllegal) {
1328
1312
ASSERT_GT (UnsignedVec[0 ], Mapper.IllegalInstrNumber );
1329
1313
}
1330
1314
1331
- // Checks that an debuginfo intrinsics are mapped to be invisible. Since they
1315
+ // Checks that an debuginfo records are mapped to be invisible. Since they
1332
1316
// do not semantically change the program, they can be recognized as similar.
1333
- // FIXME: PreserveInputDbgFormat is set to true because this test contains
1334
- // malformed debug info that cannot be converted to the new debug info format;
1335
- // this test should be updated later to use valid debug info.
1336
1317
TEST (IRInstructionMapper, DebugInfoInvisible) {
1337
1318
StringRef ModuleString = R"(
1338
1319
define i32 @f(i32 %a, i32 %b) {
1339
1320
then:
1340
- %0 = add i32 %a, %b
1341
- call void @llvm.dbg.value(metadata !0)
1342
- %1 = add i32 %a, %b
1321
+ %0 = add i32 %a, %b
1322
+ #dbg_value(i32 0, !0, !0, !0)
1323
+ %1 = add i32 %a, %b
1343
1324
ret i32 0
1344
1325
}
1345
1326
1346
- declare void @llvm.dbg.value(metadata)
1347
1327
!0 = distinct !{!"test\00", i32 10})" ;
1348
- auto SettingGuard = SaveDbgInfoFormat ();
1349
- PreserveInputDbgFormat = cl::boolOrDefault::BOU_TRUE;
1350
1328
LLVMContext Context;
1351
1329
std::unique_ptr<Module> M = makeLLVMModule (Context, ModuleString);
1352
1330
@@ -1941,22 +1919,19 @@ TEST(IRSimilarityCandidate, CheckRegionsDifferentTypes) {
1941
1919
ASSERT_FALSE (longSimCandCompare (InstrList));
1942
1920
}
1943
1921
1944
- // Check that debug instructions do not impact similarity. They are marked as
1922
+ // Check that debug records do not impact similarity. They are marked as
1945
1923
// invisible.
1946
- // FIXME: PreserveInputDbgFormat is set to true because this test contains
1947
- // malformed debug info that cannot be converted to the new debug info format;
1948
- // this test should be updated later to use valid debug info.
1949
1924
TEST (IRSimilarityCandidate, IdenticalWithDebug) {
1950
1925
StringRef ModuleString = R"(
1951
1926
define i32 @f(i32 %a, i32 %b) {
1952
1927
bb0:
1953
1928
%0 = add i32 %a, %b
1954
- call void @llvm.dbg.value(metadata !0)
1929
+ #dbg_value(i32 0, !0, !0, !0)
1955
1930
%1 = add i32 %b, %a
1956
1931
ret i32 0
1957
1932
bb1:
1958
1933
%2 = add i32 %a, %b
1959
- call void @llvm.dbg.value(metadata !1)
1934
+ #dbg_value(i32 1, !1, !1, !1)
1960
1935
%3 = add i32 %b, %a
1961
1936
ret i32 0
1962
1937
bb2:
@@ -1965,11 +1940,8 @@ TEST(IRSimilarityCandidate, IdenticalWithDebug) {
1965
1940
ret i32 0
1966
1941
}
1967
1942
1968
- declare void @llvm.dbg.value(metadata)
1969
1943
!0 = distinct !{!"test\00", i32 10}
1970
1944
!1 = distinct !{!"test\00", i32 11})" ;
1971
- auto SettingGuard = SaveDbgInfoFormat ();
1972
- PreserveInputDbgFormat = cl::boolOrDefault::BOU_TRUE;
1973
1945
LLVMContext Context;
1974
1946
std::unique_ptr<Module> M = makeLLVMModule (Context, ModuleString);
1975
1947
0 commit comments