[llvm-bugs] [Bug 45772] New: [SimplifyCFG] Alignment mismatch prevents sinking

via llvm-bugs llvm-bugs at lists.llvm.org
Fri May 1 12:33:11 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=45772

            Bug ID: 45772
           Summary: [SimplifyCFG] Alignment mismatch prevents sinking
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: nikita.ppv at gmail.com
                CC: llvm-bugs at lists.llvm.org

opt -S -simplifycfg -sink-common-insts

define void @test(i1 %c, i32* %p1, i32* %p2) {
  br i1 %c, label %if1, label %if2

if1:
  store i32 0, i32* %p1, align 4
  br label %end

if2:
  store i32 0, i32* %p2, align 8
  br label %end

end:
  ret void
}

will not sink the stores into end, because the alignment of the stores differs.
 Using align 4 on both stores will sink.

This is because SimplifyCFG checks isSameOperationAs() without the
CompareIgnoringAlignment flag. I believe it should be setting the flag and then
picking the minimum alignment for load/store (possibly by extending andIRFlags
to do that).

Noticed this as an unexpected improvement when inferring less alignment
information.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200501/b58ff407/attachment.html>


More information about the llvm-bugs mailing list