llvm-project
4e111f52 - [LoopInterchange] Add tests for a simple profitable case currently missed (NFC) (#181990)

Commit
12 days ago
[LoopInterchange] Add tests for a simple profitable case currently missed (NFC) (#181990) This patch adds test cases where the heuristic function `instorder` is somewhat inaccurate, causing the profitability decision to behave unexpectedly. The root cause is that the heuristic function assumes that the structure of GEPs "reflect" the original memory access patterns, which is not always the case. For example, given the following code: ```c int A[100][100]; for (i = 0; i < 100; i++) for (j = 0; j < 100; j++) A[i][j] = ...; ``` The heuristic assumes that the memory access will be transformed into like: ```llvm %gep = getelementptr [100 x i32], ptr %A, i32 %i, i32 %j ``` This assumption is incorrect. Actually, the heuristic cannot handle a case like the following: ```llvm %mul = mul i64 %j, 100 %offset = add i64 %i, %mul %gep = getelementptr inbounds i8, ptr %A, i64 %offset ``` The follow-up patch #181991 will address this issue. Related: #172011
Author
Parents
Loading