[PATCH] D151631: [InstSimplify] Simplify select i1 ConstExpr, i1 true, i1 false to ConstExpr
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 30 04:12:01 PDT 2023
nikic added inline comments.
================
Comment at: llvm/test/Transforms/InstSimplify/select-inseltpoison.ll:890
+;
+ %s = select i1 %a, i32 ptrtoint (ptr getelementptr inbounds ([3 x ptr], ptr @a, i64 0, i64 1) to i32), i32 undef
+ ret i32 %s
----------------
khei4 wrote:
> I think
> `i32 ptrtoint (ptr getelementptr inbounds ([3 x ptr], ptr @a, i64 0, i64 1) to i32)` doesn't produce poison.
> index seems valid so maybe
> `i32 ptrtoint (ptr getelementptr inbounds ([3 x ptr], ptr @a, i64 1, i64 0) to i32)` ?
Yes, strictly speaking this is also safe to fold, but would require analysis we don't currently do.
To make it actually poison you'd need something like `i32 ptrtoint (ptr getelementptr inbounds ([3 x ptr], ptr @a, i64 2) to i32)`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D151631/new/
https://reviews.llvm.org/D151631
More information about the llvm-commits
mailing list