Issue |
151173
|
Summary |
[CIR] Difference while lowering in GEP instruction
|
Labels |
ClangIR
|
Assignees |
|
Reporter |
Andres-Salamanca
|
While reviewing the IR generated for this PR: [https://github.com/llvm/llvm-project/pull/150687](https://github.com/llvm/llvm-project/pull/150687), we noticed that the GEP instruction is using pointer arithmetic on an `i8`:
```llvm
%val = load i16, ptr getelementptr inbounds nuw (i8, ptr ..., i64 2), align 2
```
Instead of using the structure type as in classic codegen:
```llvm
%val = load i16, ptr getelementptr inbounds nuw (%struct.S, ptr ..., i32 0, i32 1), align 2
```
Although both forms are semantically equivalent, the structure-based GEP is more readable and more reflective of the original source structure. It would be good to track this behavior and evaluate whether it should be aligned with classic codegen.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs