[clang] [InstCombine] Canonicalize constant GEPs to i8 source element type (PR #68882)
Nikita Popov via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 12 05:50:50 PDT 2023
================
@@ -637,9 +637,8 @@ define ptr @select_of_gep(i1 %c, ptr %p) {
define ptr @select_of_gep_different_type(i1 %c, ptr %p) {
; CHECK-LABEL: @select_of_gep_different_type(
-; CHECK-NEXT: [[GEP1:%.*]] = getelementptr i32, ptr [[P:%.*]], i64 1
-; CHECK-NEXT: [[GEP2:%.*]] = getelementptr i64, ptr [[P]], i64 2
-; CHECK-NEXT: [[S:%.*]] = select i1 [[C:%.*]], ptr [[GEP1]], ptr [[GEP2]]
+; CHECK-NEXT: [[S_V:%.*]] = select i1 [[C:%.*]], i64 4, i64 16
+; CHECK-NEXT: [[S:%.*]] = getelementptr i8, ptr [[P:%.*]], i64 [[S_V]]
----------------
nikic wrote:
Improvement.
https://github.com/llvm/llvm-project/pull/68882
More information about the cfe-commits
mailing list