[PATCH] D144467: [IPSCCP] Don't require noundef for !range annotation

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 9 01:25:55 PST 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG6b545db83c5a: [IPSCCP] Don't require noundef for !range annotation (authored by nikic).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144467/new/

https://reviews.llvm.org/D144467

Files:
  llvm/lib/Transforms/IPO/SCCP.cpp
  llvm/test/Transforms/SCCP/ip-add-range-to-call.ll


Index: llvm/test/Transforms/SCCP/ip-add-range-to-call.ll
===================================================================
--- llvm/test/Transforms/SCCP/ip-add-range-to-call.ll
+++ llvm/test/Transforms/SCCP/ip-add-range-to-call.ll
@@ -4,7 +4,7 @@
 ; Test 1.
 ; Both arguments and return value of @callee can be tracked. The inferred range
 ; can be added to call sites.
-define internal noundef i32 @callee(i32 %x) {
+define internal i32 @callee(i32 %x) {
 ; CHECK-LABEL: @callee(
 ; CHECK-NEXT:    ret i32 [[X:%.*]]
 ;
@@ -42,7 +42,7 @@
 
 declare void @use_cb1(ptr)
 
-define internal noundef i32 @callee2(i32 %x) {
+define internal i32 @callee2(i32 %x) {
 ; CHECK-LABEL: @callee2(
 ; CHECK-NEXT:    ret i32 [[X:%.*]]
 ;
@@ -69,7 +69,7 @@
 
 declare void @use_cb2(ptr)
 
-define internal noundef i32 @callee3(i32 %x) {
+define internal i32 @callee3(i32 %x) {
 ; CHECK-LABEL: @callee3(
 ; CHECK-NEXT:    [[C:%.*]] = icmp eq i32 [[X:%.*]], 10
 ; CHECK-NEXT:    [[S:%.*]] = select i1 [[C]], i32 500, i32 600
@@ -99,7 +99,7 @@
 
 declare void @use_cb3(ptr)
 
-define internal noundef i32 @callee4(i32 %x, i32 %y) {
+define internal i32 @callee4(i32 %x, i32 %y) {
 ; CHECK-LABEL: @callee4(
 ; CHECK-NEXT:    [[C:%.*]] = icmp eq i32 [[X:%.*]], 10
 ; CHECK-NEXT:    [[S:%.*]] = select i1 [[C]], i32 500, i32 [[Y:%.*]]
@@ -128,7 +128,7 @@
 ; Test 5.
 ; Range for the return value of callee5 includes undef. No range metadata
 ; should be added at call sites.
-define internal noundef i32 @callee5(i32 %x, i32 %y) {
+define internal i32 @callee5(i32 %x, i32 %y) {
 ; CHECK-LABEL: @callee5(
 ; CHECK-NEXT:    [[C:%.*]] = icmp slt i32 [[X:%.*]], 15
 ; CHECK-NEXT:    br i1 [[C]], label [[BB1:%.*]], label [[BB2:%.*]]
Index: llvm/lib/Transforms/IPO/SCCP.cpp
===================================================================
--- llvm/lib/Transforms/IPO/SCCP.cpp
+++ llvm/lib/Transforms/IPO/SCCP.cpp
@@ -292,13 +292,6 @@
         if (!CB || CB->getCalledFunction() != F)
           continue;
 
-        // Limit to cases where the return value is guaranteed to be neither
-        // poison nor undef. Poison will be outside any range and currently
-        // values outside of the specified range cause immediate undefined
-        // behavior.
-        if (!isGuaranteedNotToBeUndefOrPoison(CB, nullptr, CB))
-          continue;
-
         // Do not touch existing metadata for now.
         // TODO: We should be able to take the intersection of the existing
         // metadata and the inferred range.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144467.503692.patch
Type: text/x-patch
Size: 2501 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230309/f6cc1c08/attachment.bin>


More information about the llvm-commits mailing list