llvm.org GIT mirror llvm / 861b997
[IPSCCP] Restore the old behaviour (pre r293799). It's not clear the change I made a good idea, and it definitely needs further discussion. Thanks to Eli for pointing out. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293846 91177308-0d34-0410-b5e6-96231b3b80d8 Davide Italiano 2 years ago
2 changed file(s) with 1 addition(s) and 27 deletion(s). Raw diff Collapse all Expand all
17141714 // Don't touch naked functions. They may contain asm returning a
17151715 // value we don't see, so we may end up interprocedurally propagating
17161716 // the return value incorrectly.
1717 // Also, don't touch functions marked as noinline. Trivial functions may
1718 // essentially be inlined because of return value propagation.
1719 // (e.g. int tinkywinky(void) { return 666; })
1720 if (F.hasExactDefinition() &&
1721 !(F.hasFnAttribute(Attribute::Naked) ||
1722 F.hasFnAttribute(Attribute::NoInline)))
1717 if (F.hasExactDefinition() && !F.hasFnAttribute(Attribute::Naked))
17231718 Solver.AddTrackedFunction(&F);
17241719
17251720 // If this function only has direct calls that we can see, we can track its
+0
-21
test/Transforms/IPConstantProp/noinline-return.ll less more
None ; RUN: opt %s -ipsccp -S | FileCheck %s
1
2 define i32 @tinkywinky() #0 {
3 entry:
4 ret i32 5
5 }
6
7 define i32 @patatino() {
8 entry:
9 %call = call i32 @tinkywinky()
10
11 ; Check that we don't propagate the return value of
12 ; @tinkywinky.
13 ; CHECK: call i32 @dipsy(i32 %call)
14 %call1 = call i32 @dipsy(i32 %call)
15 ret i32 %call1
16 }
17
18 declare i32 @dipsy(i32)
19
20 attributes #0 = { noinline }