[llvm] (Draft) [SCEV] forgetValue: support (extractvalue 0, (with-overflow-inst op0, op1)) (PR #98015)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 8 06:50:24 PDT 2024
================
@@ -1589,4 +1589,40 @@ TEST_F(ScalarEvolutionsTest, ApplyLoopGuards) {
});
}
+TEST_F(ScalarEvolutionsTest, ForgetValueWithOverflowInst) {
+ LLVMContext C;
+ SMDiagnostic Err;
+ std::unique_ptr<Module> M = parseAssemblyString(
+ "declare { i32, i1 } @llvm.smul.with.overflow.i32(i32, i32) "
+ "define void @foo(i32 %i) { "
+ "entry: "
+ " br label %loop.body "
+ "loop.body: "
+ " %iv = phi i32 [ %iv.next, %loop.body ], [ 0, %entry ] "
+ " %iv.next = add nsw i32 %iv, 1 "
+ " %call = call {i32, i1} @llvm.smul.with.overflow.i32(i32 %iv, i32 -2) "
+ " %extractvalue = extractvalue {i32, i1} %call, 0 "
+ " %cmp = icmp eq i32 %iv.next, 16 "
+ " br i1 %cmp, label %exit, label %loop.body "
+ "exit: "
+ " ret void "
+ "} ",
+ Err, C);
----------------
v01dXYZ wrote:
If I only add a lit test, how can I be certain it will exactly test the eviction and not the fact that SCEV value was never created or the stale value used because the implementation of a pass has changed ?
I can add the case from the issue but it requires `LoopPeel` to produce a CFG that is out of sync with the SCEV value.
I don't know how to have a robust test for something as specific using an integration test.
https://github.com/llvm/llvm-project/pull/98015
More information about the llvm-commits
mailing list