diff options
Diffstat (limited to 'test/Transforms/MergeFunc')
| -rw-r--r-- | test/Transforms/MergeFunc/crash.ll | 46 | ||||
| -rw-r--r-- | test/Transforms/MergeFunc/inttoptr.ll | 55 | ||||
| -rw-r--r-- | test/Transforms/MergeFunc/vector.ll | 9 |
3 files changed, 103 insertions, 7 deletions
diff --git a/test/Transforms/MergeFunc/crash.ll b/test/Transforms/MergeFunc/crash.ll new file mode 100644 index 000000000000..0897ba289337 --- /dev/null +++ b/test/Transforms/MergeFunc/crash.ll @@ -0,0 +1,46 @@ +; RUN: opt -mergefunc -disable-output < %s +; PR15185 +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S128" +target triple = "i386-pc-linux-gnu" + +%.qux.2496 = type { i32, %.qux.2497 } +%.qux.2497 = type { i8, i32 } +%.qux.2585 = type { i32, i32, i8* } + +@g2 = external unnamed_addr constant [9 x i8], align 1 +@g3 = internal hidden unnamed_addr constant [1 x i8*] [i8* bitcast (i8* (%.qux.2585*)* @func35 to i8*)] + +define internal hidden i32 @func1(i32* %ptr, { i32, i32 }* nocapture %method) align 2 { + br label %1 + +; <label>:1 + br label %2 + +; <label>:2 + ret i32 undef +} + +define internal hidden i32 @func10(%.qux.2496* nocapture %this) align 2 { + %1 = getelementptr inbounds %.qux.2496* %this, i32 0, i32 1, i32 1 + %2 = load i32* %1, align 4 + ret i32 %2 +} + +define internal hidden i8* @func29(i32* nocapture %this) align 2 { + ret i8* getelementptr inbounds ([9 x i8]* @g2, i32 0, i32 0) +} + +define internal hidden i32* @func33(%.qux.2585* nocapture %this) align 2 { + ret i32* undef +} + +define internal hidden i32* @func34(%.qux.2585* nocapture %this) align 2 { + %1 = getelementptr inbounds %.qux.2585* %this, i32 0 + ret i32* undef +} + +define internal hidden i8* @func35(%.qux.2585* nocapture %this) align 2 { + %1 = getelementptr inbounds %.qux.2585* %this, i32 0, i32 2 + %2 = load i8** %1, align 4 + ret i8* %2 +} diff --git a/test/Transforms/MergeFunc/inttoptr.ll b/test/Transforms/MergeFunc/inttoptr.ll new file mode 100644 index 000000000000..93250fa8ed1a --- /dev/null +++ b/test/Transforms/MergeFunc/inttoptr.ll @@ -0,0 +1,55 @@ +; RUN: opt -mergefunc -S < %s | FileCheck %s +; PR15185 +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S128" +target triple = "i386-pc-linux-gnu" + +%.qux.2496 = type { i32, %.qux.2497 } +%.qux.2497 = type { i8, i32 } +%.qux.2585 = type { i32, i32, i8* } + +@g2 = external unnamed_addr constant [9 x i8], align 1 +@g3 = internal hidden unnamed_addr constant [1 x i8*] [i8* bitcast (i8* (%.qux.2585*)* @func35 to i8*)] + +define internal hidden i32 @func1(i32* %ptr, { i32, i32 }* nocapture %method) align 2 { +bb: + br label %bb1 + +bb1: ; preds = %bb + br label %bb2 + +bb2: ; preds = %bb1 + ret i32 undef +} + +define internal hidden i32 @func10(%.qux.2496* nocapture %this) align 2 { +bb: + %tmp = getelementptr inbounds %.qux.2496* %this, i32 0, i32 1, i32 1 + %tmp1 = load i32* %tmp, align 4 + ret i32 %tmp1 +} + +define internal hidden i8* @func29(i32* nocapture %this) align 2 { +bb: + ret i8* getelementptr inbounds ([9 x i8]* @g2, i32 0, i32 0) +} + +define internal hidden i32* @func33(%.qux.2585* nocapture %this) align 2 { +bb: + ret i32* undef +} + +define internal hidden i32* @func34(%.qux.2585* nocapture %this) align 2 { +bb: + %tmp = getelementptr inbounds %.qux.2585* %this, i32 0 + ret i32* undef +} + +define internal hidden i8* @func35(%.qux.2585* nocapture %this) align 2 { +bb: +; CHECK: %[[V2:.+]] = bitcast %.qux.2585* %{{.*}} to %.qux.2496* +; CHECK: %[[V3:.+]] = tail call i32 @func10(%.qux.2496* %[[V2]]) +; CHECK: %{{.*}} = inttoptr i32 %[[V3]] to i8* + %tmp = getelementptr inbounds %.qux.2585* %this, i32 0, i32 2 + %tmp1 = load i8** %tmp, align 4 + ret i8* %tmp1 +} diff --git a/test/Transforms/MergeFunc/vector.ll b/test/Transforms/MergeFunc/vector.ll index dba5fa349aba..56f74e65c60d 100644 --- a/test/Transforms/MergeFunc/vector.ll +++ b/test/Transforms/MergeFunc/vector.ll @@ -22,7 +22,7 @@ target triple = "x86_64-unknown-linux-gnu" define linkonce_odr void @_ZNSt6vectorIlSaIlEED1Ev(%"class.std::vector"* nocapture %this) unnamed_addr align 2 { entry: %tmp2.i.i = bitcast %"class.std::vector"* %this to i64** - %tmp3.i.i = load i64** %tmp2.i.i, align 8, !tbaa !0 + %tmp3.i.i = load i64** %tmp2.i.i, align 8 %tobool.i.i.i = icmp eq i64* %tmp3.i.i, null br i1 %tobool.i.i.i, label %_ZNSt6vectorIlSaIlEED2Ev.exit, label %if.then.i.i.i @@ -40,7 +40,7 @@ declare i32 @__cxa_atexit(void (i8*)*, i8*, i8*) define linkonce_odr void @_ZNSt6vectorIPvSaIS0_EED1Ev(%"class.std::vector"* nocapture %this) unnamed_addr align 2 { entry: %tmp2.i.i = bitcast %"class.std::vector"* %this to i8*** - %tmp3.i.i = load i8*** %tmp2.i.i, align 8, !tbaa !0 + %tmp3.i.i = load i8*** %tmp2.i.i, align 8 %tobool.i.i.i = icmp eq i8** %tmp3.i.i, null br i1 %tobool.i.i.i, label %_ZNSt6vectorIPvSaIS0_EED2Ev.exit, label %if.then.i.i.i @@ -70,8 +70,3 @@ declare void @_ZNSt6vectorIlSaIlEE13_M_insert_auxEN9__gnu_cxx17__normal_iterator declare void @_GLOBAL__I_a() declare %1 @llvm.uadd.with.overflow.i64(i64, i64) nounwind readnone - -!0 = metadata !{metadata !"any pointer", metadata !1} -!1 = metadata !{metadata !"omnipotent char", metadata !2} -!2 = metadata !{metadata !"Simple C/C++ TBAA", null} -!3 = metadata !{metadata !"long", metadata !1} |
