Issue 128134
Summary Missed optimization: AggressiveInstCombine misses combining loads from consecutive addresses
Labels new issue
Assignees
Reporter Cancelll
    Example: https://godbolt.org/z/14cEnPoco

Alive2: https://alive2.llvm.org/ce/z/nQ5CMj

```llvm
define i32 @src(ptr %0) {
 %2 = load i16, ptr %0, align 2
  %3 = getelementptr inbounds nuw i8, ptr %0, i64 2
  %4 = load i16, ptr %3, align 1
  %5 = zext i16 %4 to i32
  %6 = shl nuw i32 %5, 16
  %7 = zext i16 %2 to i32
  %8 = or disjoint i32 %6, %7
  ret i32 %8
}

define i32 @tgt(ptr %0) {
  %2 = load i32, ptr %0, align 2
  ret i32 %2
}
```

AgressiveInstCombine should be able to do this optimization.
https://godbolt.org/z/hY4Gfcd66

I found this pattern in function DES_xcbc_encrypt in openssl/crypto/des/xcbc_enc.c
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to