[LLVMbugs] [Bug 16710] New: Failure to constant-fold vector global
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Jul 25 19:10:45 PDT 2013
http://llvm.org/bugs/show_bug.cgi?id=16710
Bug ID: 16710
Summary: Failure to constant-fold vector global
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Interprocedural Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: silvas at purdue.edu
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
We are not able to constant-fold the use of `Global.Member` in this code (with
clang -O3):
typedef float __m128 __attribute__((__vector_size__(16)));
class GlobalType {
public:
GlobalType(float F) {
Member = (__m128){F, F, F, F}; // simplified from _mm_load1_ps
}
__m128 Member;
};
static const GlobalType Global = 42.0f;
__m128 use(__m128 V) {
return V * Global.Member;
}
However, we *are* able to fold this:
class GlobalType {
public:
GlobalType(float F) {
Member = F;
}
float Member;
};
static const GlobalType Global = 42.0f;
float use(float V) {
return V * Global.Member;
}
In the float case, the folding happens in -globalopt.
(Note: running an extra `-globalopt -constprop` after the standard -O3
optimizations does fold it; for some reason -globalopt only folds the value of
the global, but doesn't substitute its use).
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130726/636ec188/attachment.html>
More information about the llvm-bugs
mailing list