Issue 130954
Summary Missed Optimization: simplifying byte extraction after a load to a direct load of the byte
Labels
Assignees
Reporter Cancelll
    Example: https://godbolt.org/z/4eMndv4bj
Alive2: https://alive2.llvm.org/ce/z/Q_ucUS
```llvm
define i8 @src(ptr %0)  {
  %2 = getelementptr inbounds nuw i8, ptr %0, i64 12
  %3 = load i32, ptr %2, align 1
  %4 = lshr i32 %3, 16
  %5 = trunc i32 %4 to i8
  ret i8 %5
}

define i8 @tgt(ptr %0) {
  %2 = getelementptr inbounds nuw i8, ptr %0, i64 14
  %3 = load i8, ptr %2, align 1
  ret i8 %3
}
```
I found this pattern in rmd_dgst.c, sha1dgst.c, sha256.c, ssl3_cbc.c, and statem_dtls.c in openssl
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to