Issue |
132952
|
Summary |
[GVN] GVN hoists the load before `llvm.lifetime.start`
|
Labels |
miscompilation,
llvm:GVN,
generated by fuzzer
|
Assignees |
dtcxzyw
|
Reporter |
dtcxzyw
|
Reproducer: https://godbolt.org/z/z7nYed6YG
```
; bin/opt -passes=gvn test.ll -S
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
define void @_ZN25test1877_855b7795214cd9f48dump_var17h084eb43ce28d2178E() {
start:
ret void
}
define void @_ZN25test1877_855b7795214cd9f43fn417he5e8bfc10c7f64e7E(i8 %0, ptr %_24.i.i.i.i.i.i, ptr %_20.i.i.i.i.i.i, ptr %_25.i.i.i.i.i.i) {
bb2:
%_15.i.i.i = alloca [48 x i8], align 16
%_6.i.i.i = alloca [128 x i8], align 16
%_71.i.i.i.i.i.i.i = alloca [16 x i8], align 8
%_65.i.i.i.i.i.i.i = alloca [16 x i8], align 8
%_59.i.i.i.i.i.i.i = alloca [16 x i8], align 16
%_28.i.i.i.i.i.i = alloca [128 x i8], align 16
%_25.i95.i.i.i.i.i = alloca [20 x i8], align 4
%_23.i.i.i.i.i.i = alloca [128 x i8], align 16
%_18.i.i.i.i.i.i = alloca [16 x i8], align 8
%_0.i.i.i.i.i.i = alloca [16 x i8], align 16
%_25.i.i.i.i.i.i1 = alloca [48 x i8], align 8
%_24.i.i.i.i.i.i2 = alloca [128 x i8], align 16
%_20.i.i.i.i.i.i3 = alloca [48 x i8], align 16
%_11.i.i.i.i.i.i = alloca [80 x i8], align 16
%_6.i.i.i.i.i.i = alloca [80 x i8], align 16
%_4.i.i.i.i.i.i = alloca [32 x i8], align 16
%_1.i.i.i.i.i.i = alloca [16 x i8], align 16
call void @llvm.lifetime.start.p0(i64 48, ptr %_25.i.i.i.i.i.i1)
call void @llvm.lifetime.start.p0(i64 128, ptr %_24.i.i.i.i.i.i2)
call void @llvm.lifetime.start.p0(i64 48, ptr %_20.i.i.i.i.i.i3)
call void @llvm.lifetime.start.p0(i64 80, ptr %_11.i.i.i.i.i.i)
call void @llvm.lifetime.start.p0(i64 80, ptr %_6.i.i.i.i.i.i)
call void @llvm.lifetime.start.p0(i64 32, ptr %_4.i.i.i.i.i.i)
%1 = getelementptr i8, ptr %_6.i.i.i.i.i.i, i64 32
br label %bb3.i.i.i.i.i.i
bb3.i.i.i.i.i.i: ; preds = %bb3.i.i.i.i.i.i, %bb2
switch i16 1, label %_ZN25test1877_855b7795214cd9f43fn717h4e35940ffac1f080E.exit.i.i [
i16 1, label %bb4.i.i.i.i.i
i16 0, label %bb3.i.i.i.i.i.i
]
bb4.i.i.i.i.i: ; preds = %bb3.i.i.i.i.i.i
%2 = getelementptr i8, ptr %_24.i.i.i.i.i.i, i64 42
%3 = getelementptr i8, ptr %_24.i.i.i.i.i.i, i64 12
%4 = getelementptr i8, ptr %_24.i.i.i.i.i.i, i64 48
%5 = getelementptr i8, ptr %_24.i.i.i.i.i.i, i64 58
store i16 0, ptr %_24.i.i.i.i.i.i2, align 2
store i8 0, ptr %_6.i.i.i.i.i.i, align 4
%6 = getelementptr i8, ptr %_24.i.i.i.i.i.i, i64 96
%_13.i.i.i.i.i.i = getelementptr i8, ptr %_24.i.i.i.i.i.i, i64 112
%7 = getelementptr i8, ptr %_24.i.i.i.i.i.i, i64 32
store i8 0, ptr %_4.i.i.i.i.i.i, align 4
store i32 0, ptr %_4.i.i.i.i.i.i, align 8
store i128 0, ptr %_6.i.i.i.i.i.i, align 16
store i64 0, ptr %_24.i.i.i.i.i.i2, align 16
%8 = getelementptr i8, ptr %_24.i.i.i.i.i.i, i64 104
store ptr null, ptr %_24.i.i.i.i.i.i2, align 8
store i128 0, ptr %_20.i.i.i.i.i.i3, align 16
%9 = getelementptr i8, ptr %_20.i.i.i.i.i.i, i64 16
store i128 0, ptr %_20.i.i.i.i.i.i3, align 16
%10 = getelementptr i8, ptr %_20.i.i.i.i.i.i, i64 32
store i128 0, ptr %_20.i.i.i.i.i.i3, align 16
store ptr null, ptr %_6.i.i.i.i.i.i, align 16
%11 = getelementptr i8, ptr %_24.i.i.i.i.i.i, i64 40
store i8 0, ptr %_24.i.i.i.i.i.i2, align 8
call void @llvm.memcpy.p0.p0.i64(ptr null, ptr null, i64 0, i1 false)
%12 = getelementptr i8, ptr %_24.i.i.i.i.i.i, i64 16
%13 = getelementptr i8, ptr %_24.i.i.i.i.i.i, i64 8
store i16 0, ptr %_24.i.i.i.i.i.i2, align 2
store i128 0, ptr %_4.i.i.i.i.i.i, align 16
store ptr null, ptr %_4.i.i.i.i.i.i, align 16
store i8 0, ptr %_6.i.i.i.i.i.i, align 8
call void @llvm.memcpy.p0.p0.i64(ptr null, ptr null, i64 0, i1 false)
store ptr null, ptr %1, align 16
store i64 0, ptr %_25.i.i.i.i.i.i1, align 8
%14 = getelementptr i8, ptr %_25.i.i.i.i.i.i, i64 8
store i64 0, ptr %_25.i.i.i.i.i.i1, align 8
%15 = getelementptr i8, ptr %_25.i.i.i.i.i.i, i64 16
store i64 0, ptr %_25.i.i.i.i.i.i1, align 8
%16 = getelementptr i8, ptr %_25.i.i.i.i.i.i, i64 24
store i64 0, ptr %_25.i.i.i.i.i.i1, align 8
%17 = getelementptr i8, ptr %_25.i.i.i.i.i.i, i64 32
store i64 0, ptr %_25.i.i.i.i.i.i1, align 8
%18 = getelementptr i8, ptr %_25.i.i.i.i.i.i, i64 40
store i64 0, ptr %_25.i.i.i.i.i.i1, align 8
%19 = mul i8 %0, %0
store i8 0, ptr %_4.i.i.i.i.i.i, align 4
%20 = load ptr, ptr %_6.i.i.i.i.i.i, align 16
store ptr %20, ptr %_24.i.i.i.i.i.i2, align 16
%21 = load i8, ptr %_6.i.i.i.i.i.i, align 4
store i8 %21, ptr %_24.i.i.i.i.i.i2, align 4
store i32 0, ptr %_24.i.i.i.i.i.i2, align 8
store i128 0, ptr %_24.i.i.i.i.i.i2, align 16
store ptr null, ptr %_24.i.i.i.i.i.i2, align 16
%22 = getelementptr i8, ptr %_24.i.i.i.i.i.i, i64 64
call void @llvm.memcpy.p0.p0.i64(ptr null, ptr null, i64 0, i1 false)
call void @llvm.memset.p0.i64(ptr null, i8 0, i64 0, i1 false)
store ptr null, ptr %_6.i.i.i.i.i.i, align 16
%23 = load i128, ptr %_6.i.i.i.i.i.i, align 16
%24 = getelementptr i8, ptr %_24.i.i.i.i.i.i, i64 56
%25 = load i8, ptr %_6.i.i.i.i.i.i, align 8
%26 = mul i8 %25, -70
store i8 0, ptr %_24.i.i.i.i.i.i2, align 8
store ptr null, ptr %_4.i.i.i.i.i.i, align 16
store i16 0, ptr %_24.i.i.i.i.i.i2, align 2
store i128 0, ptr %_6.i.i.i.i.i.i, align 16
%27 = xor i128 %23, 1
store i128 0, ptr %_24.i.i.i.i.i.i2, align 16
store i128 0, ptr %_4.i.i.i.i.i.i, align 16
%28 = shl i8 %0, 1
store ptr null, ptr %_6.i.i.i.i.i.i, align 16
store i8 0, ptr %_6.i.i.i.i.i.i, align 4
store i32 0, ptr %_6.i.i.i.i.i.i, align 8
store i32 0, ptr %_24.i.i.i.i.i.i2, align 4
call void @llvm.memset.p0.i64(ptr null, i8 0, i64 0, i1 false)
store i32 0, ptr %_11.i.i.i.i.i.i, align 16
store ptr null, ptr %_24.i.i.i.i.i.i2, align 16
call void @llvm.memcpy.p0.p0.i64(ptr null, ptr null, i64 0, i1 false)
store i64 0, ptr %_24.i.i.i.i.i.i2, align 16
store i128 0, ptr %_11.i.i.i.i.i.i, align 16
call fastcc void @_ZN25test1877_855b7795214cd9f48dump_var17h084eb43ce28d2178E()
call fastcc void @_ZN25test1877_855b7795214cd9f48dump_var17h084eb43ce28d2178E()
call fastcc void @_ZN25test1877_855b7795214cd9f48dump_var17h084eb43ce28d2178E()
call fastcc void @_ZN25test1877_855b7795214cd9f48dump_var17h084eb43ce28d2178E()
call void @llvm.lifetime.end.p0(i64 48, ptr %_25.i.i.i.i.i.i1)
call void @llvm.lifetime.end.p0(i64 128, ptr %_24.i.i.i.i.i.i2)
call void @llvm.lifetime.end.p0(i64 48, ptr %_20.i.i.i.i.i.i3)
call void @llvm.lifetime.end.p0(i64 80, ptr %_11.i.i.i.i.i.i)
call void @llvm.lifetime.end.p0(i64 80, ptr %_6.i.i.i.i.i.i)
call void @llvm.lifetime.end.p0(i64 32, ptr %_4.i.i.i.i.i.i)
call void @llvm.lifetime.end.p0(i64 16, ptr %_1.i.i.i.i.i.i)
call void @llvm.lifetime.start.p0(i64 128, ptr %_28.i.i.i.i.i.i)
call void @llvm.lifetime.start.p0(i64 20, ptr %_25.i95.i.i.i.i.i)
call void @llvm.lifetime.start.p0(i64 128, ptr %_23.i.i.i.i.i.i)
call void @llvm.lifetime.start.p0(i64 16, ptr %_18.i.i.i.i.i.i)
call void @llvm.lifetime.start.p0(i64 16, ptr %_0.i.i.i.i.i.i)
store i128 0, ptr %_0.i.i.i.i.i.i, align 16
call void @llvm.lifetime.start.p0(i64 16, ptr %_71.i.i.i.i.i.i.i)
call void @llvm.lifetime.start.p0(i64 16, ptr %_65.i.i.i.i.i.i.i)
call void @llvm.lifetime.start.p0(i64 16, ptr %_59.i.i.i.i.i.i.i)
br label %_ZN25test1877_855b7795214cd9f43fn717h4e35940ffac1f080E.exit.i.i
_ZN25test1877_855b7795214cd9f43fn717h4e35940ffac1f080E.exit.i.i: ; preds = %bb4.i.i.i.i.i, %bb3.i.i.i.i.i.i
call void @llvm.lifetime.start.p0(i64 48, ptr %_15.i.i.i)
%29 = getelementptr i8, ptr %_15.i.i.i, i64 42
%30 = load i16, ptr %29, align 2
store i16 %30, ptr %_6.i.i.i, align 2
ret void
}
define void @_ZN25test1877_855b7795214cd9f44main17h00e36494eb335294E() {
start:
call void @_ZN25test1877_855b7795214cd9f43fn417he5e8bfc10c7f64e7E(i8 0, ptr null, ptr null, ptr null)
ret void
}
```
Generated with https://github.com/cbeuw/rustlantis + llubi.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs