Mercurial > hg > CbC > CbC_llvm
comparison llvm/test/Transforms/GVN/dbg-redundant-load.ll @ 252:1f2b6ac9f198 llvm-original
LLVM16-1
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 18 Aug 2023 09:04:13 +0900 |
parents | 1d019706d866 |
children |
comparison
equal
deleted
inserted
replaced
237:c80f45b162ad | 252:1f2b6ac9f198 |
---|---|
1 ; RUN: opt -gvn -S < %s | FileCheck %s | 1 ; RUN: opt -passes=gvn -S < %s | FileCheck %s |
2 | 2 |
3 ; Check that the redundant load from %if.then is removed. | 3 ; Check that the redundant load from %if.then is removed. |
4 ; Also, check that the debug location associated to load %0 still refers to | 4 ; Also, check that the debug location associated to load %0 still refers to |
5 ; line 3 and not line 6. | 5 ; line 3 and not line 6. |
6 | 6 |
7 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" | 7 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
8 | 8 |
9 ; CHECK: @test_redundant_load( | 9 ; CHECK: @test_redundant_load( |
10 ; CHECK-LABEL: entry: | 10 ; CHECK-LABEL: entry: |
11 ; CHECK-NEXT: load i32, i32* %Y, align 4, !dbg ![[LOC:[0-9]+]] | 11 ; CHECK-NEXT: load i32, ptr %Y, align 4, !dbg ![[LOC:[0-9]+]] |
12 ; CHECK-LABEL: if.then: | 12 ; CHECK-LABEL: if.then: |
13 ; CHECK-NOT: load | 13 ; CHECK-NOT: load |
14 ; CHECK-LABEL: if.end: | 14 ; CHECK-LABEL: if.end: |
15 ; CHECK: ![[LOC]] = !DILocation(line: 3, scope: !{{.*}}) | 15 ; CHECK: ![[LOC]] = !DILocation(line: 3, scope: !{{.*}}) |
16 | 16 |
17 define i32 @test_redundant_load(i32 %X, i32* %Y) !dbg !6 { | 17 define i32 @test_redundant_load(i32 %X, ptr %Y) !dbg !6 { |
18 entry: | 18 entry: |
19 %0 = load i32, i32* %Y, align 4, !dbg !8 | 19 %0 = load i32, ptr %Y, align 4, !dbg !8 |
20 %cmp = icmp sgt i32 %X, -1, !dbg !9 | 20 %cmp = icmp sgt i32 %X, -1, !dbg !9 |
21 br i1 %cmp, label %if.then, label %if.end, !dbg !9 | 21 br i1 %cmp, label %if.then, label %if.end, !dbg !9 |
22 | 22 |
23 if.then: ; preds = %entry | 23 if.then: ; preds = %entry |
24 %1 = load i32, i32* %Y, align 4, !dbg !10 | 24 %1 = load i32, ptr %Y, align 4, !dbg !10 |
25 %add = add nsw i32 %0, %1, !dbg !10 | 25 %add = add nsw i32 %0, %1, !dbg !10 |
26 call void @foo(), !dbg !11 | 26 call void @foo(), !dbg !11 |
27 br label %if.end, !dbg !12 | 27 br label %if.end, !dbg !12 |
28 | 28 |
29 if.end: ; preds = %if.then, %entry | 29 if.end: ; preds = %if.then, %entry |