[llvm] [InstCombine] Canonicalise SextADD + GEP (PR #69581)

via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 29 20:22:21 PDT 2023


LiqinWeng wrote:

> > Also, why did you drop the limitation to having one constant operand again?
> 

I have a question:  Why is there no nuw flag on test1, but test2 has nsw flag. 
command: clang --target=riscv64 shadd.c -O3 -emit-llvm -S -o -
codeļ¼š
```
void test1(unsigned int array1[50], unsigned int a, unsigned int b) {
    unsigned int loc;
    loc = a + 5;
    array1[loc] = b;
    array1[loc + 1] = array1[loc];
    array1[loc + 30] = loc;
}

void test2(int array1[50], int a, int b) {
    int loc;
    loc = a + 5;

    array1[loc] = b;
    array1[loc + 1] = array1[loc];
    array1[loc + 30] = loc;
}
```

![image](https://github.com/llvm/llvm-project/assets/19768075/f26bfa70-5157-49ab-bb6e-89f4e1b04536)



https://github.com/llvm/llvm-project/pull/69581


More information about the llvm-commits mailing list