-
Notifications
You must be signed in to change notification settings - Fork 17.9k
[LAA] Fix type mismatch in getStartAndEndForAccess. #183116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
2b84803
51892d4
9444d4f
372720b
1f0a7a4
525c392
e2ae56e
b4e4913
dd1818c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -250,8 +250,13 @@ static bool evaluatePtrAddRecAtMaxBTCWillNotWrap( | |
| return true; | ||
| }); | ||
| if (DerefRK) { | ||
| DerefBytesSCEV = | ||
| SE.getUMaxExpr(DerefBytesSCEV, SE.getSCEV(DerefRK.IRArgValue)); | ||
| const SCEV *DerefRKSCEV = SE.getSCEV(DerefRK.IRArgValue); | ||
| // Ensure both operands have the same type | ||
| Type *CommonTy = | ||
| SE.getWiderType(DerefBytesSCEV->getType(), DerefRKSCEV->getType()); | ||
|
kshitijvp marked this conversation as resolved.
|
||
| DerefBytesSCEV = SE.getNoopOrAnyExtend(DerefBytesSCEV, CommonTy); | ||
| DerefRKSCEV = SE.getNoopOrAnyExtend(DerefRKSCEV, CommonTy); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why any extend? Both quantities should be positive, so better always use Zext?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
| DerefBytesSCEV = SE.getUMaxExpr(DerefBytesSCEV, DerefRKSCEV); | ||
| } | ||
|
|
||
| if (DerefBytesSCEV->isZero()) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -165,6 +165,7 @@ exit: | |
| ret void | ||
| } | ||
|
|
||
| ; Function Attrs: mustprogress norecurse nosync nounwind ssp memory(read, inaccessiblemem: write, target_mem0: none, target_mem1: none) uwtable(sync) | ||
|
kshitijvp marked this conversation as resolved.
Outdated
|
||
| define void @loop_contains_store_assumed_bounds(ptr noalias %array, ptr readonly %pred, i32 %n) { | ||
| ; CHECK-LABEL: LV: Checking a loop in 'loop_contains_store_assumed_bounds' | ||
| ; CHECK: LV: Not vectorizing: Loop may fault. | ||
|
|
@@ -194,6 +195,36 @@ exit: | |
| ret void | ||
| } | ||
|
|
||
| define void @test_assumed_bounds_type_mismatch(ptr noalias %array, ptr readonly %pred, i32 %n) nosync nofree { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is there a reason we need a loop with a store? If not, would be good to remove the store and add to llvm/test/Transforms/LoopVectorize/dereferenceable-info-from-assumption-variable-size.ll. It should get vectorized with the crash fixed
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes the store is redundant in this case, needs to be removed.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removing the store instruction is causing faulting load, instead of being vectorized. |
||
| ; CHECK-LABEL: LV: Checking a loop in 'test_assumed_bounds_type_mismatch' | ||
| ; CHECK: LV: Not vectorizing: Loop may fault. | ||
| entry: | ||
| %n_bytes = mul nuw nsw i32 %n, 2 | ||
| call void @llvm.assume(i1 true) [ "dereferenceable"(ptr %pred, i32 %n_bytes) ] | ||
| %tc = sext i32 %n to i64 | ||
| br label %for.body | ||
|
|
||
| for.body: | ||
| %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.inc ] | ||
| %st.addr = getelementptr inbounds i16, ptr %array, i64 %iv | ||
| %data = load i16, ptr %st.addr, align 2 | ||
| %inc = add nsw i16 %data, 1 | ||
| store i16 %inc, ptr %st.addr, align 2 | ||
| %ee.addr = getelementptr inbounds i16, ptr %pred, i64 %iv | ||
| %ee.val = load i16, ptr %ee.addr, align 2 | ||
| %ee.cond = icmp sgt i16 %ee.val, 500 | ||
| br i1 %ee.cond, label %exit, label %for.inc | ||
|
|
||
| for.inc: | ||
| %iv.next = add nuw nsw i64 %iv, 1 | ||
| %counted.cond = icmp eq i64 %iv.next, %tc | ||
| br i1 %counted.cond, label %exit, label %for.body | ||
|
|
||
| exit: | ||
| ret void | ||
| } | ||
|
|
||
|
|
||
| define void @loop_contains_store_to_pointer_with_no_deref_info(ptr align 2 dereferenceable(40) readonly %load.array, ptr align 2 noalias %array, ptr align 2 dereferenceable(40) readonly %pred) { | ||
| ; CHECK-LABEL: LV: Checking a loop in 'loop_contains_store_to_pointer_with_no_deref_info' | ||
| ; CHECK: LV: Not vectorizing: Writes to memory unsupported in early exit loops. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.