llvm / llvm/llvm-project

Optimize same value assigned to pointers

Open
#173,905 7 comments 0 reactions 1 assignee Claimed by @Bhuvan1527 View on GitHub
llvm:optimizations missed-optimization
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

https://godbolt.org/z/9xfPcneh4

```c++
int set(unsigned int* num1, unsigned int* num2, const unsigned int value) {
*num1 = value;
*num2 = value;

return *num1 + *num2;
}
```

compiler does not recognize, that result can be calculated without reading values from pointers

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.