Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in optimization: ( A || A ) << B #960

Closed
llvmbot opened this issue Jun 25, 2005 · 1 comment
Closed

Error in optimization: ( A || A ) << B #960

llvmbot opened this issue Jun 25, 2005 · 1 comment
Labels
bugzilla Issues migrated from bugzilla invalid Resolved as invalid, i.e. not a bug llvm-tools All llvm tools that do not have corresponding tag

Comments

@llvmbot
Copy link
Member

llvmbot commented Jun 25, 2005

Bugzilla Link 588
Resolution INVALID
Resolved on Feb 22, 2010 12:49
Version 1.5
OS Linux
Reporter LLVM Bugzilla Contributor

Extended Description

Back from vacation. Working through the group of optimizer errors. This is the
reduced version.

Diff the output from this program when compiled in Optimized mode vs Debug mode.
The assumption is that there should be no differences if the compiler optimized
correctly.

/*
// --- RANDOMLY GENERATED PROGRAM ---
// Program Generator by Bryan Turner ([email protected])
*/

#include <stdio.h>
unsigned long context = 0;
unsigned long DEPTH = 0;
void DumbHash( unsigned long value, unsigned int len )
{
context += value;
context ^= 0xA50F5AF0;
printf( "%d\n", context );
}
/* --- GLOBAL VARIABLES --- */
unsigned short g_70300438 = 0xE7CA;

/* --- MAIN --- /
/
------------------------------------------ */
int main( )
{
unsigned char l_94663863 = 0xF6;
long l_03324849 = 0x9A7215CB;
long l_99194556 = 0xE4255F06;
if ( ( ( g_70300438 || g_70300438 ) << l_94663863 ) )
{
l_03324849 = l_99194556;
}
DumbHash( l_03324849, 4 );
}

@lattner
Copy link
Collaborator

lattner commented Jun 26, 2005

This is an invalid program. Shifting by a value that is greater than the number
of bits in the operand is undefined in C. In particular, this effectively performs:

X << 0xF6

Since X is a long in this case (which is 32-bits), and 0xF6 > 31, this program
is not valid.

-Chris

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
vfdff added a commit to vfdff/llvm-project that referenced this issue Dec 5, 2023
When all the large const offsets masked with the same value from bit-12 to bit-23.
Fold
  add     x8, x0, llvm#2031, lsl llvm#12
  add     x8, x8, llvm#960
  ldr     x9, [x8, x8]
  ldr     x8, [x8, llvm#2056]

into
  add     x8, x0, llvm#2031, lsl llvm#12
  ldr     x9, [x8, llvm#960]
  ldr     x8, [x8, llvm#3016]
keryell pushed a commit to keryell/llvm-project that referenced this issue Oct 19, 2024
…o llvm intrinsic (llvm#960)

This PR refactored Neon Built in code in clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp a bit to make it cleaner.

Also changed RUNOption of test file clang/test/CIR/CodeGen/AArch64/neon-arith.c to make test more concise, and easy to compare against OG (to compare, just remove -fclangir from llvm gen part of RUN, and the test should still pass)
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla invalid Resolved as invalid, i.e. not a bug llvm-tools All llvm tools that do not have corresponding tag
Projects
None yet
Development

No branches or pull requests

3 participants