[all-commits] [llvm/llvm-project] 84108e: [InstCombine] Improve no-wrap flag preservation fo...
Björn Pettersson via All-commits
all-commits at lists.llvm.org
Fri Apr 11 04:00:57 PDT 2025
Branch: refs/heads/users/bjope/addlikegep_2
Home: https://github.com/llvm/llvm-project
Commit: 84108e55aa15eeabc634671fdf7b8170d0667912
https://github.com/llvm/llvm-project/commit/84108e55aa15eeabc634671fdf7b8170d0667912
Author: Bjorn Pettersson <bjorn.a.pettersson at ericsson.com>
Date: 2025-04-11 (Fri, 11 Apr 2025)
Changed paths:
M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
M llvm/test/Transforms/InstCombine/array.ll
Log Message:
-----------
[InstCombine] Improve no-wrap flag preservation for ADD+GEP -> GEP+GEP
Given that we have a "add nuw" and a "getelementptr inbounds nuw" like
this:
%idx = add nuw i64 %idx1, %idx2
%gep = getelementptr inbounds nuw i32, ptr %ptr, i64 %idx
Then we can preserve the "inbounds nuw" flag when transforming that
into two getelementptr instructions:
%gep1 = getelementptr inbounds nuw i32, ptr %ptr, i64 %idx1
%gep = getelementptr inbounds nuw i32, ptr %ptr, i64 %idx2
Similarly for just having "nuw" or "nusw nuw" instead of "inbounds nuw"
on the getelementptr.
Proof: https://alive2.llvm.org/ce/z/QSweWW
Commit: 9b57d63a57843ca5f0ab7c8466eb5e33b0788b89
https://github.com/llvm/llvm-project/commit/9b57d63a57843ca5f0ab7c8466eb5e33b0788b89
Author: Bjorn Pettersson <bjorn.a.pettersson at ericsson.com>
Date: 2025-04-11 (Fri, 11 Apr 2025)
Changed paths:
M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
Log Message:
-----------
Fixups after review feedback:
- Make sure we try to derive inbound + nuw before doing the
ADD+GEP->GEP+GEP rewrites. This to make it possible to rely
on "nuw" being present when trying to preserve flags.
- Make sure the special ADDNSW+SEXTLIKE+GEP->GEP+GEP case is checking
for ADDNUW+ZEXTNNEG+GEP->GEP+GEP when preserving flags.
This way we do not need to check for non-negative operands.
Commit: 6f9a251e5fa149fc9d7d262c7aac077e4651aa4e
https://github.com/llvm/llvm-project/commit/6f9a251e5fa149fc9d7d262c7aac077e4651aa4e
Author: Bjorn Pettersson <bjorn.a.pettersson at ericsson.com>
Date: 2025-04-11 (Fri, 11 Apr 2025)
Changed paths:
M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
Log Message:
-----------
Fix clang-format
Commit: cc91c585be1681f4eb6b0f91382bf343139a88d1
https://github.com/llvm/llvm-project/commit/cc91c585be1681f4eb6b0f91382bf343139a88d1
Author: Bjorn Pettersson <bjorn.a.pettersson at ericsson.com>
Date: 2025-04-11 (Fri, 11 Apr 2025)
Changed paths:
M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
Log Message:
-----------
Fixup
Commit: 51ec9b0ab4799faad383e8b32c006cf1f49cf9e1
https://github.com/llvm/llvm-project/commit/51ec9b0ab4799faad383e8b32c006cf1f49cf9e1
Author: Bjorn Pettersson <bjorn.a.pettersson at ericsson.com>
Date: 2025-04-11 (Fri, 11 Apr 2025)
Changed paths:
M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
M llvm/test/Transforms/InstCombine/array.ll
Log Message:
-----------
Fixup: Also handle "nusw nuw"
Compare: https://github.com/llvm/llvm-project/compare/4895b27ac166...51ec9b0ab479
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list