From a45d0c8bd1bdad81a60da186bf46ec5affd67a8f Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Sat, 18 Oct 2014 06:36:18 +0000 Subject: [PATCH] Remove a test that was ported from the old llvm-gcc frontend test suite. This test is pretty awesome. It is claiming to test devirtualization. However, the code in question is not in fact devirtualized by LLVM. If you take the original C++ test case and run it through Clang at -O3 we fail to devirtualize it completely. It also isn't a sufficiently focused test case. The *reason* we fail to devirtualize it isn't because of any missing instcombine though. Instead, it is because we fail to emit an available externally vtable and thus the vtable is just an external and completely opaque. If I cause the vtable to be emitted, we successfully devirtualize things. Anyways, I'm just removing it because it is providing negative value at this point: it isn't representative of the output of Clang really, LLVM isn't doing the transform it claims to be testing, LLVM's failure to do the transform isn't actually an LLVM bug at all and we shouldn't be testing for it here, and finally the test is written in such a way that it will trivially pass even when the point of the test is failing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220137 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Transforms/InstCombine/devirt.ll | 39 --------------------------- 1 file changed, 39 deletions(-) delete mode 100644 test/Transforms/InstCombine/devirt.ll diff --git a/test/Transforms/InstCombine/devirt.ll b/test/Transforms/InstCombine/devirt.ll deleted file mode 100644 index 9c7cf5d697e..00000000000 --- a/test/Transforms/InstCombine/devirt.ll +++ /dev/null @@ -1,39 +0,0 @@ -; RUN: opt -instcombine -S < %s | FileCheck %s - -; CHECK-NOT: getelementptr -; CHECK-NOT: ptrtoint -; CHECK: bitcast i8* -%struct.S = type { i32 (...)** } - -@_ZL1p = internal constant { i64, i64 } { i64 1, i64 0 }, align 8 - -define void @_Z1g1S(%struct.S* %s) nounwind { -entry: - %tmp = load { i64, i64 }* @_ZL1p, align 8 - %memptr.adj = extractvalue { i64, i64 } %tmp, 1 - %0 = bitcast %struct.S* %s to i8* - %1 = getelementptr inbounds i8* %0, i64 %memptr.adj - %this.adjusted = bitcast i8* %1 to %struct.S* - %memptr.ptr = extractvalue { i64, i64 } %tmp, 0 - %2 = and i64 %memptr.ptr, 1 - %memptr.isvirtual = icmp ne i64 %2, 0 - br i1 %memptr.isvirtual, label %memptr.virtual, label %memptr.nonvirtual - -memptr.virtual: ; preds = %entry - %3 = bitcast %struct.S* %this.adjusted to i8** - %memptr.vtable = load i8** %3 - %4 = sub i64 %memptr.ptr, 1 - %5 = getelementptr i8* %memptr.vtable, i64 %4 - %6 = bitcast i8* %5 to void (%struct.S*)** - %memptr.virtualfn = load void (%struct.S*)** %6 - br label %memptr.end - -memptr.nonvirtual: ; preds = %entry - %memptr.nonvirtualfn = inttoptr i64 %memptr.ptr to void (%struct.S*)* - br label %memptr.end - -memptr.end: ; preds = %memptr.nonvirtual, %memptr.virtual - %7 = phi void (%struct.S*)* [ %memptr.virtualfn, %memptr.virtual ], [ %memptr.nonvirtualfn, %memptr.nonvirtual ] - call void %7(%struct.S* %this.adjusted) - ret void -} -- 2.34.1