mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-29 19:46:06 +00:00

relied on an artifact of how the inliner and subsequent passes in clang's -O3 mode happen to treat basic blocks and the labels for the basic blocks. In my work on the inliner, and changed this fundamental assumption, and the label that was being checked on the entry basic block will no longer appear in opt builds. There was no reason to expect the label to always be present anyways, much to my regret. I've changed the test to just ensure that we return an immediate constant. If there are intervening instructions, that's bad, but not really that relevant to the test. I'd love it if others have a better way of checking that a function body contains only a 'ret' instruction that isn't dependent on whether or not the entry block receives a label... llvm-svn: 153243
24 lines
417 B
C++
24 lines
417 B
C++
// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -O3 -o - | FileCheck %s
|
|
struct A {
|
|
virtual int vf1() { return 1; }
|
|
virtual int vf2() { return 2; }
|
|
};
|
|
|
|
int f(A* a, int (A::*fp)()) {
|
|
return (a->*fp)();
|
|
}
|
|
|
|
// CHECK: define i32 @_Z2g1v()
|
|
// CHECK: ret i32 1
|
|
int g1() {
|
|
A a;
|
|
return f(&a, &A::vf1);
|
|
}
|
|
|
|
// CHECK: define i32 @_Z2g2v()
|
|
// CHECK: ret i32 2
|
|
int g2() {
|
|
A a;
|
|
return f(&a, &A::vf2);
|
|
}
|