mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-22 13:05:52 -04:00

Scalar::MakeUnsigned was implemented incorrectly so it didn't really change the sign of the type (leaving signed types signed). This showed up as a misevaluation when IR-interpreting urem but it's likely to arise in other contexts. This commit fixes the definition, and adds a test to make sure this won't regress in future (hopefully). Fixes rdar://problem/42038760 and LLVM PR38076 Differential Revision: https://reviews.llvm.org/D49155 llvm-svn: 336872
20 lines
392 B
C
20 lines
392 B
C
// Make sure we IR-interpret the expression correctly.
|
|
|
|
typedef unsigned int uint32_t;
|
|
struct S0 {
|
|
signed f2;
|
|
};
|
|
static g_463 = 0x1561983AL;
|
|
void func_1(void)
|
|
{
|
|
struct S0 l_19;
|
|
l_19.f2 = 419;
|
|
uint32_t l_4037 = 4294967295UL;
|
|
l_19.f2 = g_463; //%self.expect("expr ((l_4037 % (-(g_463))) | l_19.f2)", substrs=['(unsigned int) $0 = 358717883'])
|
|
}
|
|
int main()
|
|
{
|
|
func_1();
|
|
return 0;
|
|
}
|