[PATCH] D70049: [CodeMoverUtils] Added an API to check if an instruction can be safely moved before another instruction.

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 26 16:24:15 PST 2019


vitalybuka added inline comments.


================
Comment at: llvm/unittests/Transforms/Utils/CodeMoverUtilsTest.cpp:145
+        // Moving PHINode is not supported.
+        EXPECT_FALSE(isSafeToMoveBefore(PN, *PN.getPrevNode(), DT, PDT, DI));
+
----------------
https://github.com/llvm/llvm-project/commit/ad58d1a9d117d46916bfff77aad0c369cee91cea.diff
to fix 
```
Note: Google Test filter = CodeMoverUtils.BasicTest
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from CodeMoverUtils
[ RUN      ] CodeMoverUtils.BasicTest
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/unittests/Transforms/Utils/CodeMoverUtilsTest.cpp:145:9: runtime error: reference binding to null pointer of type 'llvm::Instruction'
    #0 0x45d68e in operator() /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/unittests/Transforms/Utils/CodeMoverUtilsTest.cpp:145:9
    #1 0x45d68e in void llvm::function_ref<void (llvm::Function&, llvm::DominatorTree&, llvm::PostDominatorTree&, llvm::DependenceInfo&)>::callback_fn<CodeMoverUtils_BasicTest_Test::TestBody()::$_0>(long, llvm::Function&, llvm::DominatorTree&, llvm::PostDominatorTree&, llvm::DependenceInfo&) /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/include/llvm/ADT/STLExtras.h:108:12
    #2 0x45be28 in run /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/unittests/Transforms/Utils/CodeMoverUtilsTest.cpp:45:3
    #3 0x45be28 in CodeMoverUtils_BasicTest_Test::TestBody() /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/unittests/Transforms/Utils/CodeMoverUtilsTest.cpp:102:3
    #4 0x94138b in testing::Test::Run() /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:2474:5
    #5 0x94207a in testing::TestInfo::Run() /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:2656:11
    #6 0x942a42 in testing::TestCase::Run() /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:2774:28
    #7 0x94a042 in testing::internal::UnitTestImpl::RunAllTests() /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:4649:43
    #8 0x949ab5 in testing::UnitTest::Run() /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:4257:10
    #9 0x939d23 in RUN_ALL_TESTS /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/unittest/googletest/include/gtest/gtest.h:2233:46
    #10 0x939d23 in main /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/unittest/UnitTestMain/TestMain.cpp:50:10
    #11 0x7f1b4d6402e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
    #12 0x412ad9 in _start (/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/unittests/Transforms/Utils/UtilsTests+0x412ad9)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/unittests/Transforms/Utils/CodeMoverUtilsTest.cpp:145:9 in 

********************
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70049/new/

https://reviews.llvm.org/D70049





More information about the llvm-commits mailing list