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: unassignedb...@nondot.org
          Reporter: nikita....@gmail.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to