-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: update test cases for
test/LLVMDialect/InstCombine
(#441)
Previously, the test cases inside the folder `test/LLVMDialect/InstCombine` were old and did not work with `mlir-opt` (Tobias said that this was due to the changing syntax of MLIR, I believe). I updated the test cases by downloading the llvm project, and then converting the `*.ll`` files to `*.mlir` files using the following script: ```bash # Source directory SRC_DIR="llvm-project-main/llvm/test/Transforms/InstCombine/" # Destination directory DEST_DIR="lean-mlir/test/LLVMDialect/InstCombine/" # Loop through all .ll files in the source directory for file in "$SRC_DIR"*.ll; do # Get the filename without the path filename=$(basename "$file") # Convert .ll to .mlir output_file="${filename%.ll}.mlir" echo "Converting $filename to $output_file" # Perform the conversion and save to the destination directory mlir-translate -import-llvm "$file" > "$DEST_DIR$output_file" # Check if the conversion was successful if [ $? -eq 0 ]; then echo "Successfully converted $filename to $output_file" else echo "Failed to convert $filename" fi done ``` Note that Lean-Opt can still not handle these test cases, because it needs the operations to be in quotation marks. The primary difference is that before, `mlir-opt` did not work on the test cases, and now it does. --------- Co-authored-by: Atticus Kuhn <[email protected]>
- Loading branch information
1 parent
64f5e8e
commit 0aa33ef
Showing
1,465 changed files
with
186,974 additions
and
28,979 deletions.
There are no files selected for viewing
16 changes: 7 additions & 9 deletions
16
test/LLVMDialect/InstCombine/2003-05-26-CastMiscompile.ll.mlir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
"module"() ( { | ||
"llvm.func"() ( { | ||
^bb0(%arg0: i64): // no predecessors | ||
%0 = "llvm.trunc"(%arg0) : (i64) -> i32 | ||
%1 = "llvm.zext"(%0) : (i32) -> i64 | ||
"llvm.return"(%1) : (i64) -> () | ||
}) {linkage = 10 : i64, sym_name = "test", type = !llvm.func<i64 (i64)>} : () -> () | ||
"module_terminator"() : () -> () | ||
}) : () -> () | ||
module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<i64, dense<[32, 64]> : vector<2xi64>>, #dlti.dl_entry<i32, dense<32> : vector<2xi64>>, #dlti.dl_entry<i16, dense<16> : vector<2xi64>>, #dlti.dl_entry<f16, dense<16> : vector<2xi64>>, #dlti.dl_entry<i8, dense<8> : vector<2xi64>>, #dlti.dl_entry<f64, dense<64> : vector<2xi64>>, #dlti.dl_entry<i1, dense<8> : vector<2xi64>>, #dlti.dl_entry<f128, dense<128> : vector<2xi64>>, #dlti.dl_entry<!llvm.ptr, dense<64> : vector<4xi64>>, #dlti.dl_entry<"dlti.endianness", "little">>} { | ||
llvm.func @test(%arg0: i64) -> i64 { | ||
%0 = llvm.trunc %arg0 : i64 to i32 | ||
%1 = llvm.zext %0 : i32 to i64 | ||
llvm.return %1 : i64 | ||
} | ||
} |
27 changes: 13 additions & 14 deletions
27
test/LLVMDialect/InstCombine/2003-05-27-ConstExprCrash.ll.mlir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
"module"() ( { | ||
"llvm.mlir.global"() ( { | ||
}) {linkage = 10 : i64, sym_name = "X", type = i32, value = 5 : i32} : () -> () | ||
"llvm.func"() ( { | ||
%0 = "llvm.mlir.addressof"() {global_name = @X} : () -> !llvm.ptr<i32> | ||
%1 = "llvm.ptrtoint"(%0) : (!llvm.ptr<i32>) -> i64 | ||
%2 = "llvm.mlir.constant"() {value = 2 : i64} : () -> i64 | ||
%3 = "llvm.mlir.constant"() {value = 1 : i64} : () -> i64 | ||
%4 = "llvm.add"(%3, %2) : (i64, i64) -> i64 | ||
%5 = "llvm.add"(%1, %4) : (i64, i64) -> i64 | ||
"llvm.return"(%5) : (i64) -> () | ||
}) {linkage = 10 : i64, sym_name = "test", type = !llvm.func<i64 ()>} : () -> () | ||
"module_terminator"() : () -> () | ||
}) : () -> () | ||
module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<f64, dense<64> : vector<2xi64>>, #dlti.dl_entry<f16, dense<16> : vector<2xi64>>, #dlti.dl_entry<f128, dense<128> : vector<2xi64>>, #dlti.dl_entry<!llvm.ptr, dense<64> : vector<4xi64>>, #dlti.dl_entry<i8, dense<8> : vector<2xi64>>, #dlti.dl_entry<i1, dense<8> : vector<2xi64>>, #dlti.dl_entry<i32, dense<32> : vector<2xi64>>, #dlti.dl_entry<i16, dense<16> : vector<2xi64>>, #dlti.dl_entry<i64, dense<[32, 64]> : vector<2xi64>>, #dlti.dl_entry<"dlti.endianness", "little">>} { | ||
llvm.mlir.global external @X(5 : i32) {addr_space = 0 : i32} : i32 | ||
llvm.func @test() -> i64 { | ||
%0 = llvm.mlir.constant(1 : i64) : i64 | ||
%1 = llvm.mlir.constant(2 : i64) : i64 | ||
%2 = llvm.mlir.constant(5 : i32) : i32 | ||
%3 = llvm.mlir.addressof @X : !llvm.ptr | ||
%4 = llvm.ptrtoint %3 : !llvm.ptr to i64 | ||
%5 = llvm.add %0, %1 : i64 | ||
%6 = llvm.add %4, %5 : i64 | ||
llvm.return %6 : i64 | ||
} | ||
} |
22 changes: 10 additions & 12 deletions
22
test/LLVMDialect/InstCombine/2003-06-05-BranchInvertInfLoop.ll.mlir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
"module"() ( { | ||
"llvm.func"() ( { | ||
^bb0(%arg0: i1): // no predecessors | ||
%0 = "llvm.mlir.constant"() {value = 3 : i8} : () -> i8 | ||
%1 = "llvm.mlir.constant"() {value = 1 : i8} : () -> i8 | ||
%2 = "llvm.mlir.constant"() {value = true} : () -> i1 | ||
"llvm.cond_br"(%2)[^bb1, ^bb2] {operand_segment_sizes = dense<[1, 0, 0]> : vector<3xi32>} : (i1) -> () | ||
module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<i16, dense<16> : vector<2xi64>>, #dlti.dl_entry<i32, dense<32> : vector<2xi64>>, #dlti.dl_entry<i8, dense<8> : vector<2xi64>>, #dlti.dl_entry<f16, dense<16> : vector<2xi64>>, #dlti.dl_entry<f64, dense<64> : vector<2xi64>>, #dlti.dl_entry<i64, dense<[32, 64]> : vector<2xi64>>, #dlti.dl_entry<f128, dense<128> : vector<2xi64>>, #dlti.dl_entry<!llvm.ptr, dense<64> : vector<4xi64>>, #dlti.dl_entry<i1, dense<8> : vector<2xi64>>, #dlti.dl_entry<"dlti.endianness", "little">>} { | ||
llvm.func @test19(%arg0: i1) -> i8 { | ||
%0 = llvm.mlir.constant(true) : i1 | ||
%1 = llvm.mlir.constant(3 : i8) : i8 | ||
%2 = llvm.mlir.constant(1 : i8) : i8 | ||
llvm.cond_br %0, ^bb1, ^bb2 | ||
^bb1: // pred: ^bb0 | ||
"llvm.return"(%1) : (i8) -> () | ||
llvm.return %2 : i8 | ||
^bb2: // pred: ^bb0 | ||
"llvm.return"(%0) : (i8) -> () | ||
}) {linkage = 10 : i64, sym_name = "test19", type = !llvm.func<i8 (i1)>} : () -> () | ||
"module_terminator"() : () -> () | ||
}) : () -> () | ||
llvm.return %1 : i8 | ||
} | ||
} |
52 changes: 22 additions & 30 deletions
52
test/LLVMDialect/InstCombine/2003-07-21-ExternalConstant.ll.mlir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,23 @@ | ||
"module"() ( { | ||
"llvm.mlir.global"() ( { | ||
}) {constant, linkage = 10 : i64, sym_name = "silly", type = i32} : () -> () | ||
"llvm.func"() ( { | ||
}) {linkage = 10 : i64, sym_name = "bzero", type = !llvm.func<void (ptr<i8>, i32)>} : () -> () | ||
"llvm.func"() ( { | ||
}) {linkage = 10 : i64, sym_name = "bcopy", type = !llvm.func<void (ptr<i8>, ptr<i8>, i32)>} : () -> () | ||
"llvm.func"() ( { | ||
}) {linkage = 10 : i64, sym_name = "bcmp", type = !llvm.func<i32 (ptr<i8>, ptr<i8>, i32)>} : () -> () | ||
"llvm.func"() ( { | ||
}) {linkage = 10 : i64, sym_name = "fputs", type = !llvm.func<i32 (ptr<i8>, ptr<i8>)>} : () -> () | ||
"llvm.func"() ( { | ||
}) {linkage = 10 : i64, sym_name = "fputs_unlocked", type = !llvm.func<i32 (ptr<i8>, ptr<i8>)>} : () -> () | ||
"llvm.func"() ( { | ||
^bb0(%arg0: i32): // no predecessors | ||
%0 = "llvm.mlir.addressof"() {global_name = @silly} : () -> !llvm.ptr<i32> | ||
%1 = "llvm.mlir.constant"() {value = 1 : i32} : () -> i32 | ||
%2 = "llvm.alloca"(%1) : (i32) -> !llvm.ptr<i32> | ||
%3 = "llvm.alloca"(%1) : (i32) -> !llvm.ptr<i32> | ||
"llvm.store"(%arg0, %2) : (i32, !llvm.ptr<i32>) -> () | ||
%4 = "llvm.load"(%2) : (!llvm.ptr<i32>) -> i32 | ||
%5 = "llvm.load"(%0) : (!llvm.ptr<i32>) -> i32 | ||
%6 = "llvm.add"(%4, %5) : (i32, i32) -> i32 | ||
"llvm.store"(%6, %3) : (i32, !llvm.ptr<i32>) -> () | ||
"llvm.br"()[^bb1] : () -> () | ||
module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<f128, dense<128> : vector<2xi64>>, #dlti.dl_entry<!llvm.ptr, dense<32> : vector<4xi64>>, #dlti.dl_entry<i16, dense<16> : vector<2xi64>>, #dlti.dl_entry<i8, dense<8> : vector<2xi64>>, #dlti.dl_entry<i1, dense<8> : vector<2xi64>>, #dlti.dl_entry<f16, dense<16> : vector<2xi64>>, #dlti.dl_entry<f64, dense<64> : vector<2xi64>>, #dlti.dl_entry<i64, dense<[32, 64]> : vector<2xi64>>, #dlti.dl_entry<i32, dense<32> : vector<2xi64>>, #dlti.dl_entry<"dlti.endianness", "little">>} { | ||
llvm.mlir.global external constant @silly() {addr_space = 0 : i32} : i32 | ||
llvm.func @bzero(!llvm.ptr, i32) | ||
llvm.func @bcopy(!llvm.ptr, !llvm.ptr, i32) | ||
llvm.func @bcmp(!llvm.ptr, !llvm.ptr, i32) -> i32 | ||
llvm.func @fputs(!llvm.ptr, !llvm.ptr) -> i32 | ||
llvm.func @fputs_unlocked(!llvm.ptr, !llvm.ptr) -> i32 | ||
llvm.func @function(%arg0: i32) -> i32 { | ||
%0 = llvm.mlir.constant(1 : i32) : i32 | ||
%1 = llvm.mlir.addressof @silly : !llvm.ptr | ||
%2 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr | ||
%3 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr | ||
llvm.store %arg0, %2 {alignment = 4 : i64} : i32, !llvm.ptr | ||
%4 = llvm.load %2 {alignment = 4 : i64} : !llvm.ptr -> i32 | ||
%5 = llvm.load %1 {alignment = 4 : i64} : !llvm.ptr -> i32 | ||
%6 = llvm.add %4, %5 : i32 | ||
llvm.store %6, %3 {alignment = 4 : i64} : i32, !llvm.ptr | ||
llvm.br ^bb1 | ||
^bb1: // pred: ^bb0 | ||
%7 = "llvm.load"(%3) : (!llvm.ptr<i32>) -> i32 | ||
"llvm.return"(%7) : (i32) -> () | ||
}) {linkage = 10 : i64, sym_name = "function", type = !llvm.func<i32 (i32)>} : () -> () | ||
"module_terminator"() : () -> () | ||
}) : () -> () | ||
%7 = llvm.load %3 {alignment = 4 : i64} : !llvm.ptr -> i32 | ||
llvm.return %7 : i32 | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
test/LLVMDialect/InstCombine/2003-08-12-AllocaNonNull.ll.mlir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<!llvm.ptr, dense<64> : vector<4xi64>>, #dlti.dl_entry<i8, dense<8> : vector<2xi64>>, #dlti.dl_entry<i16, dense<16> : vector<2xi64>>, #dlti.dl_entry<i1, dense<8> : vector<2xi64>>, #dlti.dl_entry<i64, dense<[32, 64]> : vector<2xi64>>, #dlti.dl_entry<f16, dense<16> : vector<2xi64>>, #dlti.dl_entry<i32, dense<32> : vector<2xi64>>, #dlti.dl_entry<f64, dense<64> : vector<2xi64>>, #dlti.dl_entry<f128, dense<128> : vector<2xi64>>, #dlti.dl_entry<"dlti.endianness", "little">>} { | ||
llvm.func @bitmap_clear(...) -> i32 | ||
llvm.func @oof() -> i32 { | ||
%0 = llvm.mlir.constant(1 : i32) : i32 | ||
%1 = llvm.mlir.zero : !llvm.ptr | ||
%2 = llvm.mlir.constant(0 : i32) : i32 | ||
%3 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr | ||
%4 = llvm.icmp "ne" %3, %1 : !llvm.ptr | ||
llvm.cond_br %4, ^bb1, ^bb2 | ||
^bb1: // pred: ^bb0 | ||
%5 = llvm.call @bitmap_clear(%3) vararg(!llvm.func<i32 (...)>) : (!llvm.ptr) -> i32 | ||
llvm.br ^bb2 | ||
^bb2: // 2 preds: ^bb0, ^bb1 | ||
llvm.return %2 : i32 | ||
} | ||
} |
14 changes: 6 additions & 8 deletions
14
test/LLVMDialect/InstCombine/2003-09-09-VolatileLoadElim.ll.mlir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
"module"() ( { | ||
"llvm.func"() ( { | ||
^bb0(%arg0: !llvm.ptr<i32>): // no predecessors | ||
%0 = "llvm.load"(%arg0) : (!llvm.ptr<i32>) -> i32 | ||
"llvm.return"() : () -> () | ||
}) {linkage = 10 : i64, sym_name = "test", type = !llvm.func<void (ptr<i32>)>} : () -> () | ||
"module_terminator"() : () -> () | ||
}) : () -> () | ||
module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<!llvm.ptr, dense<64> : vector<4xi64>>, #dlti.dl_entry<f64, dense<64> : vector<2xi64>>, #dlti.dl_entry<f128, dense<128> : vector<2xi64>>, #dlti.dl_entry<i64, dense<[32, 64]> : vector<2xi64>>, #dlti.dl_entry<i32, dense<32> : vector<2xi64>>, #dlti.dl_entry<f16, dense<16> : vector<2xi64>>, #dlti.dl_entry<i1, dense<8> : vector<2xi64>>, #dlti.dl_entry<i16, dense<16> : vector<2xi64>>, #dlti.dl_entry<i8, dense<8> : vector<2xi64>>, #dlti.dl_entry<"dlti.endianness", "little">>} { | ||
llvm.func @test(%arg0: !llvm.ptr) { | ||
%0 = llvm.load volatile %arg0 {alignment = 4 : i64} : !llvm.ptr -> i32 | ||
llvm.return | ||
} | ||
} |
27 changes: 11 additions & 16 deletions
27
test/LLVMDialect/InstCombine/2003-10-29-CallSiteResolve.ll.mlir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,13 @@ | ||
"module"() ( { | ||
"llvm.func"() ( { | ||
}) {linkage = 10 : i64, sym_name = "bar", type = !llvm.func<ptr<i32> ()>} : () -> () | ||
"llvm.func"() ( { | ||
%0 = "llvm.mlir.null"() : () -> !llvm.ptr<f32> | ||
%1 = "llvm.mlir.addressof"() {global_name = @bar} : () -> !llvm.ptr<func<ptr<i32> ()>> | ||
%2 = "llvm.bitcast"(%1) : (!llvm.ptr<func<ptr<i32> ()>>) -> !llvm.ptr<func<ptr<f32> ()>> | ||
%3 = "llvm.invoke"(%2)[^bb1, ^bb2] {operand_segment_sizes = dense<[1, 0, 0]> : vector<3xi32>} : (!llvm.ptr<func<ptr<f32> ()>>) -> !llvm.ptr<f32> | ||
module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<i1, dense<8> : vector<2xi64>>, #dlti.dl_entry<!llvm.ptr, dense<64> : vector<4xi64>>, #dlti.dl_entry<f128, dense<128> : vector<2xi64>>, #dlti.dl_entry<f64, dense<64> : vector<2xi64>>, #dlti.dl_entry<f16, dense<16> : vector<2xi64>>, #dlti.dl_entry<i64, dense<[32, 64]> : vector<2xi64>>, #dlti.dl_entry<i32, dense<32> : vector<2xi64>>, #dlti.dl_entry<i16, dense<16> : vector<2xi64>>, #dlti.dl_entry<i8, dense<8> : vector<2xi64>>, #dlti.dl_entry<"dlti.endianness", "little">>} { | ||
llvm.func @bar() -> !llvm.ptr | ||
llvm.func @foo() -> !llvm.ptr attributes {personality = @__gxx_personality_v0} { | ||
%0 = llvm.mlir.zero : !llvm.ptr | ||
%1 = llvm.invoke @bar() to ^bb1 unwind ^bb2 : () -> !llvm.ptr | ||
^bb1: // pred: ^bb0 | ||
"llvm.return"(%3) : (!llvm.ptr<f32>) -> () | ||
llvm.return %1 : !llvm.ptr | ||
^bb2: // pred: ^bb0 | ||
%4 = "llvm.landingpad"() {cleanup} : () -> !llvm.struct<(ptr<i8>, i32)> | ||
"llvm.return"(%0) : (!llvm.ptr<f32>) -> () | ||
}) {linkage = 10 : i64, personality = @__gxx_personality_v0, sym_name = "foo", type = !llvm.func<ptr<f32> ()>} : () -> () | ||
"llvm.func"() ( { | ||
}) {linkage = 10 : i64, sym_name = "__gxx_personality_v0", type = !llvm.func<i32 (...)>} : () -> () | ||
"module_terminator"() : () -> () | ||
}) : () -> () | ||
%2 = llvm.landingpad cleanup : !llvm.struct<(ptr, i32)> | ||
llvm.return %0 : !llvm.ptr | ||
} | ||
llvm.func @__gxx_personality_v0(...) -> i32 | ||
} |
19 changes: 8 additions & 11 deletions
19
test/LLVMDialect/InstCombine/2003-11-03-VarargsCallBug.ll.mlir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
"module"() ( { | ||
"llvm.func"() ( { | ||
}) {linkage = 10 : i64, sym_name = "foo", type = !llvm.func<void (...)>} : () -> () | ||
"llvm.func"() ( { | ||
^bb0(%arg0: i64): // no predecessors | ||
%0 = "llvm.inttoptr"(%arg0) : (i64) -> !llvm.ptr<i32> | ||
"llvm.call"(%0) {callee = @foo, fastmathFlags = #llvm.fastmath<>} : (!llvm.ptr<i32>) -> () | ||
"llvm.return"() : () -> () | ||
}) {linkage = 10 : i64, sym_name = "test", type = !llvm.func<void (i64)>} : () -> () | ||
"module_terminator"() : () -> () | ||
}) : () -> () | ||
module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<f128, dense<128> : vector<2xi64>>, #dlti.dl_entry<i1, dense<8> : vector<2xi64>>, #dlti.dl_entry<!llvm.ptr, dense<32> : vector<4xi64>>, #dlti.dl_entry<i8, dense<8> : vector<2xi64>>, #dlti.dl_entry<i16, dense<16> : vector<2xi64>>, #dlti.dl_entry<i32, dense<32> : vector<2xi64>>, #dlti.dl_entry<i64, dense<[32, 64]> : vector<2xi64>>, #dlti.dl_entry<f16, dense<16> : vector<2xi64>>, #dlti.dl_entry<f64, dense<64> : vector<2xi64>>, #dlti.dl_entry<"dlti.endianness", "little">>} { | ||
llvm.func @foo(...) | ||
llvm.func @test(%arg0: i64) { | ||
%0 = llvm.inttoptr %arg0 : i64 to !llvm.ptr | ||
llvm.call @foo(%0) vararg(!llvm.func<void (...)>) : (!llvm.ptr) -> () | ||
llvm.return | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
test/LLVMDialect/InstCombine/2004-01-13-InstCombineInvokePHI.ll.mlir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<i64, dense<[32, 64]> : vector<2xi64>>, #dlti.dl_entry<i32, dense<32> : vector<2xi64>>, #dlti.dl_entry<i16, dense<16> : vector<2xi64>>, #dlti.dl_entry<f128, dense<128> : vector<2xi64>>, #dlti.dl_entry<f64, dense<64> : vector<2xi64>>, #dlti.dl_entry<f16, dense<16> : vector<2xi64>>, #dlti.dl_entry<i8, dense<8> : vector<2xi64>>, #dlti.dl_entry<i1, dense<8> : vector<2xi64>>, #dlti.dl_entry<!llvm.ptr, dense<64> : vector<4xi64>>, #dlti.dl_entry<"dlti.endianness", "little">>} { | ||
llvm.func @test() -> !llvm.ptr | ||
llvm.func @foo() -> i32 attributes {personality = @__gxx_personality_v0} { | ||
%0 = llvm.mlir.zero : !llvm.ptr | ||
%1 = llvm.mlir.constant(true) : i1 | ||
%2 = llvm.mlir.constant(0 : i32) : i32 | ||
llvm.cond_br %1, ^bb3(%0 : !llvm.ptr), ^bb1 | ||
^bb1: // pred: ^bb0 | ||
%3 = llvm.invoke @test() to ^bb2 unwind ^bb4 : () -> !llvm.ptr | ||
^bb2: // pred: ^bb1 | ||
llvm.br ^bb3(%3 : !llvm.ptr) | ||
^bb3(%4: !llvm.ptr): // 2 preds: ^bb0, ^bb2 | ||
%5 = llvm.load %4 {alignment = 4 : i64} : !llvm.ptr -> i32 | ||
llvm.return %5 : i32 | ||
^bb4: // pred: ^bb1 | ||
%6 = llvm.landingpad cleanup : !llvm.struct<(ptr, i32)> | ||
llvm.return %2 : i32 | ||
} | ||
llvm.func @__gxx_personality_v0(...) -> i32 | ||
} |
31 changes: 14 additions & 17 deletions
31
test/LLVMDialect/InstCombine/2004-02-23-ShiftShiftOverflow.ll.mlir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
"module"() ( { | ||
"llvm.func"() ( { | ||
^bb0(%arg0: i32): // no predecessors | ||
%0 = "llvm.mlir.constant"() {value = 17 : i32} : () -> i32 | ||
%1 = "llvm.ashr"(%arg0, %0) : (i32, i32) -> i32 | ||
%2 = "llvm.ashr"(%1, %0) : (i32, i32) -> i32 | ||
"llvm.return"(%2) : (i32) -> () | ||
}) {linkage = 10 : i64, sym_name = "test", type = !llvm.func<i32 (i32)>} : () -> () | ||
"llvm.func"() ( { | ||
^bb0(%arg0: i32): // no predecessors | ||
%0 = "llvm.mlir.constant"() {value = 17 : i32} : () -> i32 | ||
%1 = "llvm.shl"(%arg0, %0) : (i32, i32) -> i32 | ||
%2 = "llvm.shl"(%1, %0) : (i32, i32) -> i32 | ||
"llvm.return"(%2) : (i32) -> () | ||
}) {linkage = 10 : i64, sym_name = "test2", type = !llvm.func<i32 (i32)>} : () -> () | ||
"module_terminator"() : () -> () | ||
}) : () -> () | ||
module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<i1, dense<8> : vector<2xi64>>, #dlti.dl_entry<!llvm.ptr, dense<64> : vector<4xi64>>, #dlti.dl_entry<i32, dense<32> : vector<2xi64>>, #dlti.dl_entry<i16, dense<16> : vector<2xi64>>, #dlti.dl_entry<i8, dense<8> : vector<2xi64>>, #dlti.dl_entry<f128, dense<128> : vector<2xi64>>, #dlti.dl_entry<i64, dense<[32, 64]> : vector<2xi64>>, #dlti.dl_entry<f16, dense<16> : vector<2xi64>>, #dlti.dl_entry<f64, dense<64> : vector<2xi64>>, #dlti.dl_entry<"dlti.endianness", "little">>} { | ||
llvm.func @test(%arg0: i32) -> i32 { | ||
%0 = llvm.mlir.constant(17 : i32) : i32 | ||
%1 = llvm.ashr %arg0, %0 : i32 | ||
%2 = llvm.ashr %1, %0 : i32 | ||
llvm.return %2 : i32 | ||
} | ||
llvm.func @test2(%arg0: i32) -> i32 { | ||
%0 = llvm.mlir.constant(17 : i32) : i32 | ||
%1 = llvm.shl %arg0, %0 : i32 | ||
%2 = llvm.shl %1, %0 : i32 | ||
llvm.return %2 : i32 | ||
} | ||
} |
22 changes: 10 additions & 12 deletions
22
test/LLVMDialect/InstCombine/2004-03-13-InstCombineInfLoop.ll.mlir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
"module"() ( { | ||
"llvm.func"() ( { | ||
^bb0(%arg0: i32, %arg1: i32): // no predecessors | ||
%0 = "llvm.mlir.constant"() {value = 0 : i32} : () -> i32 | ||
%1 = "llvm.sub"(%0, %arg0) : (i32, i32) -> i32 | ||
%2 = "llvm.bitcast"(%1) : (i32) -> i32 | ||
%3 = "llvm.sub"(%0, %arg1) : (i32, i32) -> i32 | ||
%4 = "llvm.icmp"(%2, %3) {predicate = 0 : i64} : (i32, i32) -> i1 | ||
"llvm.return"(%4) : (i1) -> () | ||
}) {linkage = 10 : i64, sym_name = "test", type = !llvm.func<i1 (i32, i32)>} : () -> () | ||
"module_terminator"() : () -> () | ||
}) : () -> () | ||
module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<i16, dense<16> : vector<2xi64>>, #dlti.dl_entry<i32, dense<32> : vector<2xi64>>, #dlti.dl_entry<i1, dense<8> : vector<2xi64>>, #dlti.dl_entry<i8, dense<8> : vector<2xi64>>, #dlti.dl_entry<f16, dense<16> : vector<2xi64>>, #dlti.dl_entry<f64, dense<64> : vector<2xi64>>, #dlti.dl_entry<i64, dense<[32, 64]> : vector<2xi64>>, #dlti.dl_entry<f128, dense<128> : vector<2xi64>>, #dlti.dl_entry<!llvm.ptr, dense<64> : vector<4xi64>>, #dlti.dl_entry<"dlti.endianness", "little">>} { | ||
llvm.func @test(%arg0: i32, %arg1: i32) -> i1 { | ||
%0 = llvm.mlir.constant(0 : i32) : i32 | ||
%1 = llvm.sub %0, %arg0 : i32 | ||
%2 = llvm.bitcast %1 : i32 to i32 | ||
%3 = llvm.sub %0, %arg1 : i32 | ||
%4 = llvm.icmp "eq" %2, %3 : i32 | ||
llvm.return %4 : i1 | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
test/LLVMDialect/InstCombine/2004-04-04-InstCombineReplaceAllUsesWith.ll.mlir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<f128, dense<128> : vector<2xi64>>, #dlti.dl_entry<!llvm.ptr, dense<64> : vector<4xi64>>, #dlti.dl_entry<i1, dense<8> : vector<2xi64>>, #dlti.dl_entry<i16, dense<16> : vector<2xi64>>, #dlti.dl_entry<i8, dense<8> : vector<2xi64>>, #dlti.dl_entry<i32, dense<32> : vector<2xi64>>, #dlti.dl_entry<i64, dense<[32, 64]> : vector<2xi64>>, #dlti.dl_entry<f64, dense<64> : vector<2xi64>>, #dlti.dl_entry<f16, dense<16> : vector<2xi64>>, #dlti.dl_entry<"dlti.endianness", "little">>} { | ||
llvm.func @test() -> i32 { | ||
%0 = llvm.mlir.constant(0 : i32) : i32 | ||
llvm.return %0 : i32 | ||
} | ||
} |
15 changes: 6 additions & 9 deletions
15
test/LLVMDialect/InstCombine/2004-05-07-UnsizedCastLoad.ll.mlir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
"module"() ( { | ||
"llvm.func"() ( { | ||
^bb0(%arg0: !llvm.ptr<struct<"Ty", opaque>>): // no predecessors | ||
%0 = "llvm.bitcast"(%arg0) : (!llvm.ptr<struct<"Ty", opaque>>) -> !llvm.ptr<i32> | ||
%1 = "llvm.load"(%0) : (!llvm.ptr<i32>) -> i32 | ||
"llvm.return"(%1) : (i32) -> () | ||
}) {linkage = 10 : i64, sym_name = "test", type = !llvm.func<i32 (ptr<struct<"Ty", opaque>>)>} : () -> () | ||
"module_terminator"() : () -> () | ||
}) : () -> () | ||
module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<!llvm.ptr, dense<64> : vector<4xi64>>, #dlti.dl_entry<f64, dense<64> : vector<2xi64>>, #dlti.dl_entry<f128, dense<128> : vector<2xi64>>, #dlti.dl_entry<i32, dense<32> : vector<2xi64>>, #dlti.dl_entry<i64, dense<[32, 64]> : vector<2xi64>>, #dlti.dl_entry<f16, dense<16> : vector<2xi64>>, #dlti.dl_entry<i1, dense<8> : vector<2xi64>>, #dlti.dl_entry<i16, dense<16> : vector<2xi64>>, #dlti.dl_entry<i8, dense<8> : vector<2xi64>>, #dlti.dl_entry<"dlti.endianness", "little">>} { | ||
llvm.func @test(%arg0: !llvm.ptr) -> i32 { | ||
%0 = llvm.load %arg0 {alignment = 4 : i64} : !llvm.ptr -> i32 | ||
llvm.return %0 : i32 | ||
} | ||
} |
22 changes: 10 additions & 12 deletions
22
test/LLVMDialect/InstCombine/2004-07-27-ConstantExprMul.ll.mlir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
"module"() ( { | ||
"llvm.mlir.global"() ( { | ||
}) {linkage = 4 : i64, sym_name = "p", type = i32, value = 0 : i32} : () -> () | ||
"llvm.func"() ( { | ||
^bb0(%arg0: i32): // no predecessors | ||
%0 = "llvm.mlir.addressof"() {global_name = @p} : () -> !llvm.ptr<i32> | ||
%1 = "llvm.ptrtoint"(%0) : (!llvm.ptr<i32>) -> i32 | ||
%2 = "llvm.mul"(%arg0, %1) : (i32, i32) -> i32 | ||
"llvm.return"(%2) : (i32) -> () | ||
}) {linkage = 10 : i64, sym_name = "test", type = !llvm.func<i32 (i32)>} : () -> () | ||
"module_terminator"() : () -> () | ||
}) : () -> () | ||
module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<!llvm.ptr, dense<64> : vector<4xi64>>, #dlti.dl_entry<i1, dense<8> : vector<2xi64>>, #dlti.dl_entry<f16, dense<16> : vector<2xi64>>, #dlti.dl_entry<f128, dense<128> : vector<2xi64>>, #dlti.dl_entry<f64, dense<64> : vector<2xi64>>, #dlti.dl_entry<i8, dense<8> : vector<2xi64>>, #dlti.dl_entry<i16, dense<16> : vector<2xi64>>, #dlti.dl_entry<i64, dense<[32, 64]> : vector<2xi64>>, #dlti.dl_entry<i32, dense<32> : vector<2xi64>>, #dlti.dl_entry<"dlti.endianness", "little">>} { | ||
llvm.mlir.global weak @p(0 : i32) {addr_space = 0 : i32} : i32 | ||
llvm.func @test(%arg0: i32) -> i32 { | ||
%0 = llvm.mlir.constant(0 : i32) : i32 | ||
%1 = llvm.mlir.addressof @p : !llvm.ptr | ||
%2 = llvm.ptrtoint %1 : !llvm.ptr to i32 | ||
%3 = llvm.mul %arg0, %2 : i32 | ||
llvm.return %3 : i32 | ||
} | ||
} |
Oops, something went wrong.