[llvm] e8ff03b - [Tests] Move test from Assembler to InstSimplify (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 3 05:44:56 PDT 2024


Author: Nikita Popov
Date: 2024-06-03T14:44:21+02:00
New Revision: e8ff03b574fc4279367939acd6a5ddd798286766

URL: https://github.com/llvm/llvm-project/commit/e8ff03b574fc4279367939acd6a5ddd798286766
DIFF: https://github.com/llvm/llvm-project/commit/e8ff03b574fc4279367939acd6a5ddd798286766.diff

LOG: [Tests] Move test from Assembler to InstSimplify (NFC)

Make sure this test is preserved when icmp constant expressions
are removed.

Added: 
    

Modified: 
    llvm/test/Transforms/InstSimplify/compare.ll

Removed: 
    llvm/test/Assembler/2007-04-25-AssemblerFoldExternWeak.ll


################################################################################
diff  --git a/llvm/test/Assembler/2007-04-25-AssemblerFoldExternWeak.ll b/llvm/test/Assembler/2007-04-25-AssemblerFoldExternWeak.ll
deleted file mode 100644
index cf7a904b1a19e..0000000000000
--- a/llvm/test/Assembler/2007-04-25-AssemblerFoldExternWeak.ll
+++ /dev/null
@@ -1,9 +0,0 @@
-; RUN: llvm-as < %s | llvm-dis | FileCheck %s
-; RUN: verify-uselistorder %s
-; PR1358
-
-; CHECK: icmp ne (ptr @test_weak, ptr null)
- at G = global i1 icmp ne (ptr @test_weak, ptr null)
-
-declare extern_weak i32 @test_weak(...)
-

diff  --git a/llvm/test/Transforms/InstSimplify/compare.ll b/llvm/test/Transforms/InstSimplify/compare.ll
index 1e78bb232f797..d975b77469691 100644
--- a/llvm/test/Transforms/InstSimplify/compare.ll
+++ b/llvm/test/Transforms/InstSimplify/compare.ll
@@ -282,6 +282,17 @@ define i1 @gep17() {
   ret i1 %cmp
 }
 
+ at weak = extern_weak global i8
+
+define i1 @extern_weak_may_be_null() {
+; CHECK-LABEL: @extern_weak_may_be_null(
+; CHECK-NEXT:    [[CMP:%.*]] = icmp ne ptr @weak, null
+; CHECK-NEXT:    ret i1 [[CMP]]
+;
+  %cmp = icmp ne ptr @weak, null
+  ret i1 %cmp
+}
+
 ; Negative test: GEP inbounds may cross sign boundary.
 define i1 @gep_same_base_constant_indices(ptr %a) {
 ; CHECK-LABEL: @gep_same_base_constant_indices(


        


More information about the llvm-commits mailing list